This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 6c7ce83d0ee763b73b124fdabd1f87585b7fe442 Author: Otavio Rodolfo Piske <angusyo...@gmail.com> AuthorDate: Fri Jan 31 11:55:20 2025 +0100 (chores) camel-bean: use pattern variables --- .../java/org/apache/camel/component/bean/BeanInfo.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanInfo.java b/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanInfo.java index ce6d50fa282..02fb72a3d7b 100644 --- a/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanInfo.java +++ b/components/camel-bean/src/main/java/org/apache/camel/component/bean/BeanInfo.java @@ -1028,25 +1028,21 @@ public class BeanInfo { private Expression createParameterUnmarshalExpressionForAnnotation( Method method, Class<?> parameterType, Annotation annotation) { - if (annotation instanceof ExchangeProperty) { - ExchangeProperty propertyAnnotation = (ExchangeProperty) annotation; + if (annotation instanceof ExchangeProperty propertyAnnotation) { return ExpressionBuilder.exchangePropertyExpression(propertyAnnotation.value()); } else if (annotation instanceof ExchangeProperties) { return ExpressionBuilder.exchangePropertiesExpression(); - } else if (annotation instanceof Header) { - Header headerAnnotation = (Header) annotation; + } else if (annotation instanceof Header headerAnnotation) { return ExpressionBuilder.headerExpression(headerAnnotation.value()); } else if (annotation instanceof Headers) { return ExpressionBuilder.headersExpression(); - } else if (annotation instanceof Variable) { - Variable variableAnnotation = (Variable) annotation; + } else if (annotation instanceof Variable variableAnnotation) { return ExpressionBuilder.variableExpression(variableAnnotation.value()); } else if (annotation instanceof Variables) { return ExpressionBuilder.variablesExpression(); } else if (annotation instanceof ExchangeException) { return ExpressionBuilder.exchangeExceptionExpression(CastUtils.cast(parameterType, Exception.class)); - } else if (annotation instanceof PropertyInject) { - PropertyInject propertyAnnotation = (PropertyInject) annotation; + } else if (annotation instanceof PropertyInject propertyAnnotation) { Expression inject = ExpressionBuilder.propertiesComponentExpression(propertyAnnotation.value(), propertyAnnotation.defaultValue()); return ExpressionBuilder.convertToExpression(inject, parameterType); @@ -1059,8 +1055,7 @@ public class BeanInfo { type = DefaultAnnotationExpressionFactory.class; } Object object = camelContext.getInjector().newInstance(type); - if (object instanceof AnnotationExpressionFactory) { - AnnotationExpressionFactory expressionFactory = (AnnotationExpressionFactory) object; + if (object instanceof AnnotationExpressionFactory expressionFactory) { return expressionFactory.createExpression(camelContext, annotation, languageAnnotation, parameterType); } else { LOG.warn(