This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch camel-3.0.x in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.0.x by this push: new 3ac9dec CAMEL-14300: Java 8 Supplier overloadings break all DSLs 3ac9dec is described below commit 3ac9dec8923ead6bc96d2f15cfd0b907d57ed6b8 Author: lburgazzoli <lburgazz...@gmail.com> AuthorDate: Mon Dec 16 13:35:00 2019 +0100 CAMEL-14300: Java 8 Supplier overloadings break all DSLs --- .../org/apache/camel/builder/ExpressionClause.java | 59 ++++++++++++---------- .../apache/camel/model/MulticastDefinition.java | 3 ++ .../apache/camel/model/ProcessorDefinition.java | 14 +++-- .../camel/model/RecipientListDefinition.java | 3 ++ .../org/apache/camel/model/SplitDefinition.java | 3 ++ .../org/apache/camel/model/WireTapDefinition.java | 6 +++ 6 files changed, 56 insertions(+), 32 deletions(-) diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/builder/ExpressionClause.java b/core/camel-core-engine/src/main/java/org/apache/camel/builder/ExpressionClause.java index a0cd5f2..beac72e 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/builder/ExpressionClause.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/builder/ExpressionClause.java @@ -130,7 +130,10 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * A functional expression of an inbound message body + * + * @deprecated see https://issues.apache.org/jira/browse/CAMEL-14300 */ + @Deprecated public T body(final Supplier<Object> supplier) { return delegate.expression(new ExpressionAdapter() { public Object evaluate(Exchange exchange) { @@ -217,7 +220,7 @@ public class ExpressionClause<T> implements Expression, Predicate { * <a href="http://camel.apache.org/bean-language.html">bean language</a> * which basically means the bean is invoked to determine the expression * value. - * + * * @param bean the name of the bean looked up the registry * @return the builder to continue processing the DSL */ @@ -243,7 +246,7 @@ public class ExpressionClause<T> implements Expression, Predicate { * <a href="http://camel.apache.org/bean-language.html">bean language</a> * which basically means the bean is invoked to determine the expression * value. - * + * * @param beanType the Class of the bean which we want to invoke * @return the builder to continue processing the DSL */ @@ -256,7 +259,7 @@ public class ExpressionClause<T> implements Expression, Predicate { * <a href="http://camel.apache.org/bean-language.html">bean language</a> * which basically means the bean is invoked to determine the expression * value. - * + * * @param bean the name of the bean looked up the registry * @param method the name of the method to invoke on the bean * @return the builder to continue processing the DSL @@ -284,7 +287,7 @@ public class ExpressionClause<T> implements Expression, Predicate { * <a href="http://camel.apache.org/bean-language.html">bean language</a> * which basically means the bean is invoked to determine the expression * value. - * + * * @param beanType the Class of the bean which we want to invoke * @param method the name of the method to invoke on the bean * @return the builder to continue processing the DSL @@ -296,7 +299,7 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * Evaluates a <a href="http://camel.apache.org/groovy.html">Groovy * expression</a> - * + * * @param text the expression to be evaluated * @return the builder to continue processing the DSL */ @@ -410,7 +413,7 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * Evaluates an <a href="http://camel.apache.org/ognl.html">OGNL * expression</a> - * + * * @param text the expression to be evaluated * @return the builder to continue processing the DSL */ @@ -432,7 +435,7 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * Evaluates a <a href="http://camel.apache.org/ref-language.html">Ref * expression</a> - * + * * @param ref refers to the expression to be evaluated * @return the builder to continue processing the DSL */ @@ -443,7 +446,7 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * Evaluates a <a href="http://camel.apache.org/spel.html">SpEL * expression</a> - * + * * @param text the expression to be evaluated * @return the builder to continue processing the DSL */ @@ -454,7 +457,7 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * Evaluates a <a href="http://camel.apache.org/simple.html">Simple * expression</a> - * + * * @param text the expression to be evaluated * @return the builder to continue processing the DSL */ @@ -702,7 +705,7 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath * expression</a> - * + * * @param text the expression to be evaluated * @return the builder to continue processing the DSL */ @@ -713,7 +716,7 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath * expression</a> on the supplied header name's contents - * + * * @param text the expression to be evaluated * @param headerName the name of the header to apply the expression to * @return the builder to continue processing the DSL @@ -725,7 +728,7 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath * expression</a> with the specified result type - * + * * @param text the expression to be evaluated * @param resultType the return type expected by the expression * @return the builder to continue processing the DSL @@ -738,7 +741,7 @@ public class ExpressionClause<T> implements Expression, Predicate { * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath * expression</a> with the specified result type on the supplied header * name's contents - * + * * @param text the expression to be evaluated * @param resultType the return type expected by the expression * @param headerName the name of the header to apply the expression to @@ -752,7 +755,7 @@ public class ExpressionClause<T> implements Expression, Predicate { * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath * expression</a> with the specified result type and set of namespace * prefixes and URIs - * + * * @param text the expression to be evaluated * @param resultType the return type expected by the expression * @param namespaces the namespace prefix and URIs to use @@ -766,7 +769,7 @@ public class ExpressionClause<T> implements Expression, Predicate { * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath * expression</a> with the specified result type and set of namespace * prefixes and URIs on the supplied header name's contents - * + * * @param text the expression to be evaluated * @param resultType the return type expected by the expression * @param headerName the name of the header to apply the expression to @@ -781,7 +784,7 @@ public class ExpressionClause<T> implements Expression, Predicate { * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath * expression</a> with the specified result type and set of namespace * prefixes and URIs - * + * * @param text the expression to be evaluated * @param resultType the return type expected by the expression * @param namespaces the namespace prefix and URIs to use @@ -794,7 +797,7 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath * expression</a> with the specified set of namespace prefixes and URIs - * + * * @param text the expression to be evaluated * @param namespaces the namespace prefix and URIs to use * @return the builder to continue processing the DSL @@ -806,7 +809,7 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath * expression</a> with the specified set of namespace prefixes and URIs - * + * * @param text the expression to be evaluated * @param namespaces the namespace prefix and URIs to use * @return the builder to continue processing the DSL @@ -818,7 +821,7 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * Evaluates an <a href="http://camel.apache.org/xquery.html">XQuery * expression</a> - * + * * @param text the expression to be evaluated * @return the builder to continue processing the DSL */ @@ -829,7 +832,7 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath * expression</a> on the supplied header name's contents - * + * * @param text the expression to be evaluated * @param headerName the name of the header to apply the expression to * @return the builder to continue processing the DSL @@ -841,7 +844,7 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * Evaluates an <a href="http://camel.apache.org/xquery.html">XQuery * expression</a> with the specified result type - * + * * @param text the expression to be evaluated * @param resultType the return type expected by the expression * @return the builder to continue processing the DSL @@ -853,7 +856,7 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * Evaluates an <a href="http://camel.apache.org/xquery.html">XQuery * expression</a> with the specified result type - * + * * @param text the expression to be evaluated * @param resultType the return type expected by the expression * @param headerName the name of the header to apply the expression to @@ -867,7 +870,7 @@ public class ExpressionClause<T> implements Expression, Predicate { * Evaluates an <a href="http://camel.apache.org/xquery.html">XQuery * expression</a> with the specified result type and set of namespace * prefixes and URIs - * + * * @param text the expression to be evaluated * @param resultType the return type expected by the expression * @param namespaces the namespace prefix and URIs to use @@ -880,7 +883,7 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * Evaluates an <a href="http://camel.apache.org/xquery.html">XQuery * expression</a> with the specified result type - * + * * @param text the expression to be evaluated * @param resultType the return type expected by the expression * @param headerName the name of the header to apply the expression to @@ -895,7 +898,7 @@ public class ExpressionClause<T> implements Expression, Predicate { * Evaluates an <a href="http://camel.apache.org/xquery.html">XQuery * expression</a> with the specified result type and set of namespace * prefixes and URIs - * + * * @param text the expression to be evaluated * @param resultType the return type expected by the expression * @param namespaces the namespace prefix and URIs to use @@ -908,7 +911,7 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * Evaluates an <a href="http://camel.apache.org/xquery.html">XQuery * expression</a> with the specified set of namespace prefixes and URIs - * + * * @param text the expression to be evaluated * @param namespaces the namespace prefix and URIs to use * @return the builder to continue processing the DSL @@ -920,7 +923,7 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * Evaluates an <a href="http://camel.apache.org/xquery.html">XQuery * expression</a> with the specified set of namespace prefixes and URIs - * + * * @param text the expression to be evaluated * @param namespaces the namespace prefix and URIs to use * @return the builder to continue processing the DSL @@ -931,7 +934,7 @@ public class ExpressionClause<T> implements Expression, Predicate { /** * Evaluates a given language name with the expression text - * + * * @param language the name of the language * @param expression the expression in the given language * @return the builder to continue processing the DSL diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/MulticastDefinition.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/MulticastDefinition.java index 8a72687..d88db45 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/model/MulticastDefinition.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/MulticastDefinition.java @@ -313,7 +313,10 @@ public class MulticastDefinition extends OutputDefinition<MulticastDefinition> i * * @param onPrepare the processor * @return the builder + * + * @deprecated see https://issues.apache.org/jira/browse/CAMEL-14300 */ + @Deprecated public MulticastDefinition onPrepare(Supplier<Processor> onPrepare) { setOnPrepare(onPrepare.get()); return this; diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/ProcessorDefinition.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/ProcessorDefinition.java index d28282f..2ef182d 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/model/ProcessorDefinition.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/ProcessorDefinition.java @@ -2413,7 +2413,10 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type> * * @param processor the custom {@link Processor} * @return the builder + * + * @deprecated see https://issues.apache.org/jira/browse/CAMEL-14300 */ + @Deprecated public Type process(Supplier<Processor> processor) { return process(processor.get()); } @@ -2665,7 +2668,10 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type> * * @param supplier the supplier that provides a value to the IN message body * @return the builder + * + * @deprecated see https://issues.apache.org/jira/browse/CAMEL-14300 */ + @Deprecated public <Result> Type setBody(Supplier<Result> supplier) { SetBodyDefinition answer = new SetBodyDefinition(new ExpressionAdapter() { @Override @@ -3088,7 +3094,7 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type> * Enricher EIP</a> enriches an exchange with additional data obtained from * a <code>resourceUri</code> and with an aggregation strategy created using * a fluent builder. <blockquote> - * + * * <pre> * {@code * fom("direct:start") @@ -3096,7 +3102,7 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type> * .body(String.class, (o, n) -> n + o); * } * </pre> - * + * * </blockquote> * * @param resourceUri URI of resource endpoint for obtaining additional @@ -3139,7 +3145,7 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type> * Enricher EIP</a> enriches an exchange with additional data obtained from * a <code>resourceUri</code> and with an aggregation strategy created using * a fluent builder. <blockquote> - * + * * <pre> * {@code * fom("direct:start") @@ -3147,7 +3153,7 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type> * .body(String.class, (o, n) -> n + o); * } * </pre> - * + * * </blockquote> * * @param resourceUri URI of resource endpoint for obtaining additional diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/RecipientListDefinition.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/RecipientListDefinition.java index 27a34b5..7326e5a 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/model/RecipientListDefinition.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/RecipientListDefinition.java @@ -330,7 +330,10 @@ public class RecipientListDefinition<Type extends ProcessorDefinition<Type>> ext * * @param onPrepare the processor * @return the builder + * + * @deprecated see https://issues.apache.org/jira/browse/CAMEL-14300 */ + @Deprecated public RecipientListDefinition<Type> onPrepare(Supplier<Processor> onPrepare) { setOnPrepare(onPrepare.get()); return this; diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/SplitDefinition.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/SplitDefinition.java index 4b86e44..b8a95f3 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/model/SplitDefinition.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/SplitDefinition.java @@ -304,7 +304,10 @@ public class SplitDefinition extends OutputExpressionNode implements ExecutorSer * * @param onPrepare the processor * @return the builder + * + * @deprecated see https://issues.apache.org/jira/browse/CAMEL-14300 */ + @Deprecated public SplitDefinition onPrepare(Supplier<Processor> onPrepare) { setOnPrepare(onPrepare.get()); return this; diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/WireTapDefinition.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/WireTapDefinition.java index b3ece35..d99d339 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/model/WireTapDefinition.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/WireTapDefinition.java @@ -220,7 +220,10 @@ public class WireTapDefinition<Type extends ProcessorDefinition<Type>> extends T * @param processor processor preparing the new exchange to send * @return the builder * @see #newExchangeHeader(String, org.apache.camel.Expression) + * + * @deprecated see https://issues.apache.org/jira/browse/CAMEL-14300 */ + @Deprecated public WireTapDefinition<Type> newExchange(Supplier<Processor> processor) { setNewExchangeProcessor(processor.get()); return this; @@ -265,7 +268,10 @@ public class WireTapDefinition<Type extends ProcessorDefinition<Type>> extends T * * @param onPrepare the processor * @return the builder + * + * @deprecated see https://issues.apache.org/jira/browse/CAMEL-14300 */ + @Deprecated public WireTapDefinition<Type> onPrepare(Supplier<Processor> onPrepare) { setOnPrepare(onPrepare.get()); return this;