From c2e6af4d44da86459300e4f133cc49153419677f Mon Sep 17 00:00:00 2001 From: Otavio Rodolfo Piske Date: Wed, 21 Aug 2024 10:44:47 +0200 Subject: [PATCH] (chores) convert core/camel-core-reifier to use pattern matching for instanceof --- .../apache/camel/reifier/AbstractReifier.java | 4 +-- .../camel/reifier/AggregateReifier.java | 4 +-- .../org/apache/camel/reifier/BeanReifier.java | 4 +-- .../apache/camel/reifier/ChoiceReifier.java | 7 ++-- .../camel/reifier/ClaimCheckReifier.java | 8 ++--- .../camel/reifier/MulticastReifier.java | 8 ++--- .../camel/reifier/ProcessorReifier.java | 36 +++++++++---------- .../camel/reifier/RecipientListReifier.java | 8 ++--- .../camel/reifier/ResequenceReifier.java | 8 ++--- .../camel/reifier/ResumableReifier.java | 4 +-- .../apache/camel/reifier/RouteReifier.java | 4 +-- .../apache/camel/reifier/SplitReifier.java | 8 ++--- .../reifier/dataformat/DataFormatReifier.java | 11 +++--- .../errorhandler/ErrorHandlerReifier.java | 14 ++++---- .../reifier/language/ExpressionReifier.java | 8 ++--- .../XMLTokenizerExpressionReifier.java | 3 +- .../language/XPathExpressionReifier.java | 3 +- .../language/XQueryExpressionReifier.java | 3 +- 18 files changed, 71 insertions(+), 74 deletions(-) diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/AbstractReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/AbstractReifier.java index f0c9da843ba3f..21e6976c05b89 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/AbstractReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/AbstractReifier.java @@ -109,8 +109,8 @@ protected T parse(Class clazz, String text) { } protected T parse(Class clazz, Object text) { - if (text instanceof String) { - text = parseString((String) text); + if (text instanceof String string) { + text = parseString(string); } return CamelContextHelper.convertTo(camelContext, clazz, text); } diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/AggregateReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/AggregateReifier.java index 5a5910d381a0e..d4ae4a28337b0 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/AggregateReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/AggregateReifier.java @@ -132,11 +132,11 @@ && parseBoolean(definition.getDiscardOnAggregationFailure(), false)) { if (definition.getCompletionPredicate() != null) { Predicate predicate = createPredicate(definition.getCompletionPredicate()); answer.setCompletionPredicate(predicate); - } else if (strategy instanceof Predicate) { + } else if (strategy instanceof Predicate predicate) { // if aggregation strategy implements predicate and was not // configured then use as fallback LOG.debug("Using AggregationStrategy as completion predicate: {}", strategy); - answer.setCompletionPredicate((Predicate) strategy); + answer.setCompletionPredicate(predicate); } if (definition.getCompletionTimeoutExpression() != null) { Expression expression = createExpression(definition.getCompletionTimeoutExpression()); diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/BeanReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/BeanReifier.java index 13ae49d35ba03..00eb5956fdcf0 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/BeanReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/BeanReifier.java @@ -47,9 +47,9 @@ public Processor createProcessor() throws Exception { scope = parse(BeanScope.class, definition.getScope()); } Processor answer = fac.createBeanProcessor(camelContext, bean, beanType, beanClass, ref, method, scope); - if (answer instanceof IdAware) { + if (answer instanceof IdAware idAware) { String id = camelContext.getCamelContextExtension().getContextPlugin(NodeIdFactory.class).createId(definition); - ((IdAware) answer).setId(id); + idAware.setId(id); } return answer; } diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ChoiceReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ChoiceReifier.java index 31e39795957d4..11e050104330f 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ChoiceReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ChoiceReifier.java @@ -75,8 +75,7 @@ private void initBranch(WhenDefinition whenClause) { exp = exp.getExpressionType(); } Predicate pre = exp.getPredicate(); - if (pre instanceof ExpressionFactoryAware) { - ExpressionFactoryAware aware = (ExpressionFactoryAware) pre; + if (pre instanceof ExpressionFactoryAware aware) { if (aware.getExpressionFactory() != null) { // if using the Java DSL then the expression may have been // set using the @@ -88,8 +87,8 @@ private void initBranch(WhenDefinition whenClause) { // reset the expression to the expression type the // ExpressionClause did build for us ExpressionFactory model = aware.getExpressionFactory(); - if (model instanceof ExpressionDefinition) { - whenClause.setExpression((ExpressionDefinition) model); + if (model instanceof ExpressionDefinition expressionDefinition) { + whenClause.setExpression(expressionDefinition); } } } diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ClaimCheckReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ClaimCheckReifier.java index 55c1569da3b69..76606e89dbbaf 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ClaimCheckReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ClaimCheckReifier.java @@ -115,10 +115,10 @@ private AggregationStrategy createAggregationStrategy() { String ref = parseString(definition.getAggregationStrategy()); if (strategy == null && ref != null) { Object aggStrategy = lookupByName(ref); - if (aggStrategy instanceof AggregationStrategy) { - strategy = (AggregationStrategy) aggStrategy; - } else if (aggStrategy instanceof BiFunction) { - strategy = new AggregationStrategyBiFunctionAdapter((BiFunction) aggStrategy); + if (aggStrategy instanceof AggregationStrategy aggregationStrategy) { + strategy = aggregationStrategy; + } else if (aggStrategy instanceof BiFunction biFunction) { + strategy = new AggregationStrategyBiFunctionAdapter(biFunction); } else if (aggStrategy != null) { strategy = new AggregationStrategyBeanAdapter(aggStrategy, definition.getAggregationStrategyMethodName()); } else { diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/MulticastReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/MulticastReifier.java index b9b6fa79129fe..20bdfc3e2f2df 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/MulticastReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/MulticastReifier.java @@ -88,11 +88,11 @@ private AggregationStrategy createAggregationStrategy() { String ref = parseString(definition.getAggregationStrategy()); if (strategy == null && ref != null) { Object aggStrategy = lookupByName(ref); - if (aggStrategy instanceof AggregationStrategy) { - strategy = (AggregationStrategy) aggStrategy; - } else if (aggStrategy instanceof BiFunction) { + if (aggStrategy instanceof AggregationStrategy aggregationStrategy) { + strategy = aggregationStrategy; + } else if (aggStrategy instanceof BiFunction biFunction) { AggregationStrategyBiFunctionAdapter adapter - = new AggregationStrategyBiFunctionAdapter((BiFunction) aggStrategy); + = new AggregationStrategyBiFunctionAdapter(biFunction); if (definition.getAggregationStrategyMethodAllowNull() != null) { adapter.setAllowNullNewExchange(parseBoolean(definition.getAggregationStrategyMethodAllowNull(), false)); adapter.setAllowNullOldExchange(parseBoolean(definition.getAggregationStrategyMethodAllowNull(), false)); diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ProcessorReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ProcessorReifier.java index e6339a78701db..23ee99751b78a 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ProcessorReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ProcessorReifier.java @@ -468,8 +468,8 @@ public ScheduledExecutorService getConfiguredScheduledExecutorService( // prefer to use explicit configured executor on the definition if (definition.getExecutorServiceBean() != null) { ExecutorService executorService = definition.getExecutorServiceBean(); - if (executorService instanceof ScheduledExecutorService) { - return (ScheduledExecutorService) executorService; + if (executorService instanceof ScheduledExecutorService scheduledExecutorService) { + return scheduledExecutorService; } throw new IllegalArgumentException( "ExecutorServiceRef " + definition.getExecutorServiceRef() @@ -651,8 +651,8 @@ public void addRoutes() throws Exception { */ public Channel wrapProcessor(Processor processor) throws Exception { // don't double wrap - if (processor instanceof Channel) { - return (Channel) processor; + if (processor instanceof Channel channel) { + return channel; } return wrapChannel(processor, null); } @@ -794,8 +794,8 @@ protected Processor wrapInErrorHandler(Processor output) throws Exception { Processor errorHandler = ((ModelCamelContext) camelContext).getModelReifierFactory().createErrorHandler(route, builder, output); - if (output instanceof ErrorHandlerAware) { - ((ErrorHandlerAware) output).setErrorHandler(errorHandler); + if (output instanceof ErrorHandlerAware errorHandlerAware) { + errorHandlerAware.setErrorHandler(errorHandler); } return errorHandler; @@ -823,12 +823,12 @@ protected Processor createOutputsProcessor(Collection> ou Processor processor = createProcessor(output); // inject id - if (processor instanceof IdAware) { + if (processor instanceof IdAware idAware) { String id = getId(output); - ((IdAware) processor).setId(id); + idAware.setId(id); } - if (processor instanceof RouteIdAware) { - ((RouteIdAware) processor).setRouteId(route.getRouteId()); + if (processor instanceof RouteIdAware routeIdAware) { + routeIdAware.setRouteId(route.getRouteId()); } if (output instanceof Channel && processor == null) { @@ -894,12 +894,12 @@ protected Channel makeProcessor() throws Exception { } // inject id - if (processor instanceof IdAware) { + if (processor instanceof IdAware idAware) { String id = getId(definition); - ((IdAware) processor).setId(id); + idAware.setId(id); } - if (processor instanceof RouteIdAware) { - ((RouteIdAware) processor).setRouteId(route.getRouteId()); + if (processor instanceof RouteIdAware routeIdAware) { + routeIdAware.setRouteId(route.getRouteId()); } if (processor == null) { @@ -951,11 +951,11 @@ public AggregationStrategy getConfiguredAggregationStrategy(AggregationStrategyA AggregationStrategy strategy = definition.getAggregationStrategyBean(); if (strategy == null && definition.getAggregationStrategyRef() != null) { Object aggStrategy = lookupByName(definition.getAggregationStrategyRef()); - if (aggStrategy instanceof AggregationStrategy) { - strategy = (AggregationStrategy) aggStrategy; - } else if (aggStrategy instanceof BiFunction) { + if (aggStrategy instanceof AggregationStrategy aggregationStrategy) { + strategy = aggregationStrategy; + } else if (aggStrategy instanceof BiFunction biFunction) { AggregationStrategyBiFunctionAdapter adapter - = new AggregationStrategyBiFunctionAdapter((BiFunction) aggStrategy); + = new AggregationStrategyBiFunctionAdapter(biFunction); if (definition.getAggregationStrategyMethodAllowNull() != null) { adapter.setAllowNullNewExchange(parseBoolean(definition.getAggregationStrategyMethodAllowNull(), false)); adapter.setAllowNullOldExchange(parseBoolean(definition.getAggregationStrategyMethodAllowNull(), false)); diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RecipientListReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RecipientListReifier.java index 5ced2c43173d5..c352ae803fe6f 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RecipientListReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RecipientListReifier.java @@ -117,11 +117,11 @@ private AggregationStrategy createAggregationStrategy() { String ref = parseString(definition.getAggregationStrategy()); if (strategy == null && ref != null) { Object aggStrategy = lookupByName(ref); - if (aggStrategy instanceof AggregationStrategy) { - strategy = (AggregationStrategy) aggStrategy; - } else if (aggStrategy instanceof BiFunction) { + if (aggStrategy instanceof AggregationStrategy aggregationStrategy) { + strategy = aggregationStrategy; + } else if (aggStrategy instanceof BiFunction biFunction) { AggregationStrategyBiFunctionAdapter adapter - = new AggregationStrategyBiFunctionAdapter((BiFunction) aggStrategy); + = new AggregationStrategyBiFunctionAdapter(biFunction); if (definition.getAggregationStrategyMethodAllowNull() != null) { adapter.setAllowNullNewExchange(parseBoolean(definition.getAggregationStrategyMethodAllowNull(), false)); adapter.setAllowNullOldExchange(parseBoolean(definition.getAggregationStrategyMethodAllowNull(), false)); diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ResequenceReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ResequenceReifier.java index fa50ae9b27be4..abc1aec7a1852 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ResequenceReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ResequenceReifier.java @@ -44,10 +44,10 @@ public Processor createProcessor() throws Exception { ResequencerConfig resequencer = definition.getResequencerConfig(); StreamResequencerConfig stream = definition.getStreamConfig(); BatchResequencerConfig batch = definition.getBatchConfig(); - if (resequencer instanceof StreamResequencerConfig) { - stream = (StreamResequencerConfig) resequencer; - } else if (resequencer instanceof BatchResequencerConfig) { - batch = (BatchResequencerConfig) resequencer; + if (resequencer instanceof StreamResequencerConfig streamResequencerConfig) { + stream = streamResequencerConfig; + } else if (resequencer instanceof BatchResequencerConfig batchResequencerConfig) { + batch = batchResequencerConfig; } if (stream != null) { diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ResumableReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ResumableReifier.java index 43195d509696d..404ceecec638f 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ResumableReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/ResumableReifier.java @@ -44,8 +44,8 @@ public Processor createProcessor() throws Exception { ResumeStrategy resumeStrategy = resolveResumeStrategy(); ObjectHelper.notNull(resumeStrategy, ResumeStrategy.DEFAULT_NAME, definition); - if (resumeStrategy instanceof CamelContextAware) { - ((CamelContextAware) resumeStrategy).setCamelContext(camelContext); + if (resumeStrategy instanceof CamelContextAware camelContextAware) { + camelContextAware.setCamelContext(camelContext); } route.setResumeStrategy(resumeStrategy); diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RouteReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RouteReifier.java index eb707b9e45f12..7cd8082735aa8 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RouteReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RouteReifier.java @@ -404,8 +404,8 @@ public void close() throws IOException { private void prepareErrorHandlerAware(Route route, Processor errorHandler) { List processors = route.filter("*"); for (Processor p : processors) { - if (p instanceof ErrorHandlerAware) { - ((ErrorHandlerAware) p).setErrorHandler(errorHandler); + if (p instanceof ErrorHandlerAware errorHandlerAware) { + errorHandlerAware.setErrorHandler(errorHandler); } } } diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/SplitReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/SplitReifier.java index 55fc66c1e4b95..555aac6332bb3 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/SplitReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/SplitReifier.java @@ -85,11 +85,11 @@ private AggregationStrategy createAggregationStrategy() { AggregationStrategy strategy = definition.getAggregationStrategyBean(); if (strategy == null && definition.getAggregationStrategy() != null) { Object aggStrategy = lookupByName(definition.getAggregationStrategy()); - if (aggStrategy instanceof AggregationStrategy) { - strategy = (AggregationStrategy) aggStrategy; - } else if (aggStrategy instanceof BiFunction) { + if (aggStrategy instanceof AggregationStrategy aggregationStrategy) { + strategy = aggregationStrategy; + } else if (aggStrategy instanceof BiFunction biFunction) { AggregationStrategyBiFunctionAdapter adapter - = new AggregationStrategyBiFunctionAdapter((BiFunction) aggStrategy); + = new AggregationStrategyBiFunctionAdapter(biFunction); if (definition.getAggregationStrategyMethodAllowNull() != null) { adapter.setAllowNullNewExchange(parseBoolean(definition.getAggregationStrategyMethodAllowNull(), false)); adapter.setAllowNullOldExchange(parseBoolean(definition.getAggregationStrategyMethodAllowNull(), false)); diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java index 19773563cd591..65097c1298ea2 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java @@ -269,11 +269,12 @@ public DataFormat createDataFormat() { if (dataFormat == null) { dataFormat = doCreateDataFormat(); if (dataFormat != null) { - if (dataFormat instanceof DataFormatContentTypeHeader && definition instanceof ContentTypeHeaderAware) { - String header = ((ContentTypeHeaderAware) definition).getContentTypeHeader(); + if (dataFormat instanceof DataFormatContentTypeHeader dataFormatContentTypeHeader + && definition instanceof ContentTypeHeaderAware contentTypeHeaderAware) { + String header = contentTypeHeaderAware.getContentTypeHeader(); // is enabled by default so assume true if null final boolean contentTypeHeader = parseBoolean(header, true); - ((DataFormatContentTypeHeader) dataFormat).setContentTypeHeader(contentTypeHeader); + dataFormatContentTypeHeader.setContentTypeHeader(contentTypeHeader); } // configure the rest of the options configureDataFormat(dataFormat); @@ -328,8 +329,8 @@ private PropertyConfigurer findPropertyConfigurer(DataFormat dataFormat) { PropertyConfigurer configurer = null; String name = getDataFormatName(); LOG.trace("Discovering optional dataformat property configurer class for dataformat: {}", name); - if (dataFormat instanceof PropertyConfigurerAware) { - configurer = ((PropertyConfigurerAware) dataFormat).getPropertyConfigurer(dataFormat); + if (dataFormat instanceof PropertyConfigurerAware propertyConfigurerAware) { + configurer = propertyConfigurerAware.getPropertyConfigurer(dataFormat); if (LOG.isDebugEnabled() && configurer != null) { LOG.debug("Discovered dataformat property configurer using the PropertyConfigurerAware: {} -> {}", name, configurer); diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/errorhandler/ErrorHandlerReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/errorhandler/ErrorHandlerReifier.java index f75eadd1a6ab6..dd2f7454bebae 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/errorhandler/ErrorHandlerReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/errorhandler/ErrorHandlerReifier.java @@ -92,10 +92,10 @@ public static ErrorHandlerReifier reifier(Route r } private static ErrorHandlerReifier coreReifier(Route route, ErrorHandlerFactory definition) { - if (definition instanceof DeadLetterChannelDefinition) { - return new DeadLetterChannelReifier(route, (DeadLetterChannelDefinition) definition); - } else if (definition instanceof DefaultErrorHandlerDefinition) { - return new DefaultErrorHandlerReifier(route, (DefaultErrorHandlerDefinition) definition); + if (definition instanceof DeadLetterChannelDefinition deadLetterChannelDefinition) { + return new DeadLetterChannelReifier(route, deadLetterChannelDefinition); + } else if (definition instanceof DefaultErrorHandlerDefinition defaultErrorHandlerDefinition) { + return new DefaultErrorHandlerReifier(route, defaultErrorHandlerDefinition); } else if (definition instanceof NoErrorHandlerDefinition) { return new NoErrorHandlerReifier(route, definition); } else if (definition instanceof RefErrorHandlerDefinition) { @@ -343,9 +343,9 @@ public void configure(ErrorHandler handler) { addExceptionPolicy(handlerSupport, (OnExceptionDefinition) exception); } } - if (handler instanceof RedeliveryErrorHandler) { - boolean original = ((RedeliveryErrorHandler) handler).isUseOriginalMessagePolicy() - || ((RedeliveryErrorHandler) handler).isUseOriginalBodyPolicy(); + if (handler instanceof RedeliveryErrorHandler redeliveryErrorHandler) { + boolean original = redeliveryErrorHandler.isUseOriginalMessagePolicy() + || redeliveryErrorHandler.isUseOriginalBodyPolicy(); if (original) { // ensure allow original is turned on route.setAllowUseOriginalMessage(true); diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/ExpressionReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/ExpressionReifier.java index af1fa95e8a3ed..d3ec9c1c1be92 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/ExpressionReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/ExpressionReifier.java @@ -237,8 +237,8 @@ protected void configurePredicate(Predicate predicate) { // allows to perform additional logic after the properties has been // configured which may be needed // in the various camel components outside camel-core - if (predicate instanceof AfterPropertiesConfigured) { - ((AfterPropertiesConfigured) predicate).afterPropertiesConfigured(camelContext); + if (predicate instanceof AfterPropertiesConfigured afterPropertiesConfigured) { + afterPropertiesConfigured.afterPropertiesConfigured(camelContext); } } @@ -246,8 +246,8 @@ protected void configureExpression(Expression expression) { // allows to perform additional logic after the properties has been // configured which may be needed // in the various camel components outside camel-core - if (expression instanceof AfterPropertiesConfigured) { - ((AfterPropertiesConfigured) expression).afterPropertiesConfigured(camelContext); + if (expression instanceof AfterPropertiesConfigured afterPropertiesConfigured) { + afterPropertiesConfigured.afterPropertiesConfigured(camelContext); } } diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/XMLTokenizerExpressionReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/XMLTokenizerExpressionReifier.java index 8de85bfb6ffe9..5f5b0e0ba70ec 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/XMLTokenizerExpressionReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/XMLTokenizerExpressionReifier.java @@ -40,8 +40,7 @@ protected void configureExpression(Expression expression) { } protected void configureNamespaceAware(Object builder) { - if (definition.getNamespaces() != null && builder instanceof NamespaceAware) { - NamespaceAware namespaceAware = (NamespaceAware) builder; + if (definition.getNamespaces() != null && builder instanceof NamespaceAware namespaceAware) { namespaceAware.setNamespaces(definition.getNamespaces()); } } diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/XPathExpressionReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/XPathExpressionReifier.java index 6507fdca67e83..f8b2ac95090ca 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/XPathExpressionReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/XPathExpressionReifier.java @@ -45,8 +45,7 @@ protected void configureExpression(Expression expression) { } protected void configureNamespaceAware(Object builder) { - if (definition.getNamespaces() != null && builder instanceof NamespaceAware) { - NamespaceAware namespaceAware = (NamespaceAware) builder; + if (definition.getNamespaces() != null && builder instanceof NamespaceAware namespaceAware) { namespaceAware.setNamespaces(definition.getNamespaces()); } } diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/XQueryExpressionReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/XQueryExpressionReifier.java index e85a06e9d855d..4cfdc70bcd649 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/XQueryExpressionReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/XQueryExpressionReifier.java @@ -41,8 +41,7 @@ protected void configureExpression(Expression expression) { } protected void configureNamespaceAware(Object builder) { - if (definition.getNamespaces() != null && builder instanceof NamespaceAware) { - NamespaceAware namespaceAware = (NamespaceAware) builder; + if (definition.getNamespaces() != null && builder instanceof NamespaceAware namespaceAware) { namespaceAware.setNamespaces(definition.getNamespaces()); } }