This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 369213719a1ba438b80f51fd95a6e1ea326079ab Author: Claus Ibsen <[email protected]> AuthorDate: Fri Jul 26 07:41:45 2019 +0200 CAMEL-13788: Deprecate OUT in favour of getMessage on Message API. --- MIGRATION.md | 13 ++ .../org/apache/camel/component/bean/BeanInfo.java | 3 - .../camel/component/mock/MockExpressionClause.java | 35 ------ .../mock/MockExpressionClauseSupport.java | 35 ------ .../src/main/java/org/apache/camel/OutHeaders.java | 34 ------ core/camel-base/src/main/docs/simple-language.adoc | 14 --- .../simple/ast/SimpleFunctionExpression.java | 17 --- .../org/apache/camel/builder/ExpressionClause.java | 99 --------------- .../camel/builder/ExpressionClauseSupport.java | 35 ------ .../bean/BeanWithHeadersAndBodyInject3Test.java | 10 +- .../camel/component/mock/MockPredicateTest.java | 16 --- .../apache/camel/language/simple/SimpleTest.java | 15 --- .../DeadLetterChannelHandledExampleTest.java | 19 ++- .../camel/support/builder/ExpressionBuilder.java | 135 --------------------- 14 files changed, 23 insertions(+), 457 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index 105e464..1251c57 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -147,6 +147,19 @@ To use this API you can get it via the `getMessage` method on `Exchange`: The fault API has been removed from `org.apache.camel.Message` as it was only used for SOAP-WS fault message. The `camel-cxf` and `camel-spring-ws` components for SOAP-WS has been modified to support fault messages from their components. The option `handleFault` has also been removed and you now need to turn this on as endpoint or component option on `camel-cxf` or `camel-spring-ws`. +### getOut on Message + +The `hasOut` and `getOut` methods on `Message` has been deprecated in favour of using `getMessage` instead. (sidenote: The camel-core are still using these methods in a few places to be backwards compatible and rely on this logic as Camel was initially designed with the concepts of IN and OUT message inspired from the JBI and SOAP-WS specifications). + +### OUT message removed from Simple language and Mock component + +The simple language has removed the OUT message concepts eg `${out.body}`. +Also the mock component has removed OUT message from its assertion API, eg + + mock.message(0).outBody()... + +Also the `@OutHeaders` annotation for bean parameter binding has been removed, instead use `@Headers` instead. + ### Mock component The `mock` component has been moved out of `camel-core` and as part of this work, we had to remove a number of methods on its _assertion clause builder_ that were seldom in use. 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 088ca1f..1c7a4fb 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 @@ -41,7 +41,6 @@ import org.apache.camel.Handler; import org.apache.camel.Header; import org.apache.camel.Headers; import org.apache.camel.Message; -import org.apache.camel.OutHeaders; import org.apache.camel.PropertyInject; import org.apache.camel.spi.Registry; import org.apache.camel.support.IntrospectionSupport; @@ -973,8 +972,6 @@ public class BeanInfo { return ExpressionBuilder.headerExpression(headerAnnotation.value()); } else if (annotation instanceof Headers) { return ExpressionBuilder.headersExpression(); - } else if (annotation instanceof OutHeaders) { - return ExpressionBuilder.outHeadersExpression(); } else if (annotation instanceof ExchangeException) { return ExpressionBuilder.exchangeExceptionExpression(CastUtils.cast(parameterType, Exception.class)); } else if (annotation instanceof PropertyInject) { diff --git a/components/camel-mock/src/main/java/org/apache/camel/component/mock/MockExpressionClause.java b/components/camel-mock/src/main/java/org/apache/camel/component/mock/MockExpressionClause.java index f21f86b..aa3c77d 100644 --- a/components/camel-mock/src/main/java/org/apache/camel/component/mock/MockExpressionClause.java +++ b/components/camel-mock/src/main/java/org/apache/camel/component/mock/MockExpressionClause.java @@ -114,13 +114,6 @@ public class MockExpressionClause<T> implements Expression, Predicate { } /** - * An expression of an outbound message - */ - public T outMessage() { - return delegate.outMessage(); - } - - /** * A functional expression of an outbound message */ public T outMessage(final Function<Message, Object> function) { @@ -205,13 +198,6 @@ public class MockExpressionClause<T> implements Expression, Predicate { } /** - * An expression of an outbound message body - */ - public T outBody() { - return delegate.outBody(); - } - - /** * A functional expression of an outbound message body */ public T outBody(final Function<Object, Object> function) { @@ -236,13 +222,6 @@ public class MockExpressionClause<T> implements Expression, Predicate { } /** - * An expression of an outbound message body converted to the expected type - */ - public T outBody(Class<?> expectedType) { - return delegate.outBody(expectedType); - } - - /** * A functional expression of an outbound message body converted to the expected type */ public <B> T outBody(Class<B> expectedType, final Function<B, Object> function) { @@ -281,20 +260,6 @@ public class MockExpressionClause<T> implements Expression, Predicate { } /** - * An expression of an outbound message header of the given name - */ - public T outHeader(String name) { - return delegate.outHeader(name); - } - - /** - * An expression of the outbound headers - */ - public T outHeaders() { - return delegate.outHeaders(); - } - - /** * An expression of an exchange property of the given name */ public T exchangeProperty(String name) { diff --git a/components/camel-mock/src/main/java/org/apache/camel/component/mock/MockExpressionClauseSupport.java b/components/camel-mock/src/main/java/org/apache/camel/component/mock/MockExpressionClauseSupport.java index f06d764..80ce1f1 100644 --- a/components/camel-mock/src/main/java/org/apache/camel/component/mock/MockExpressionClauseSupport.java +++ b/components/camel-mock/src/main/java/org/apache/camel/component/mock/MockExpressionClauseSupport.java @@ -84,13 +84,6 @@ public class MockExpressionClauseSupport<T> { } /** - * An expression of an inbound message - */ - public T outMessage() { - return expression(ExpressionBuilder.outMessageExpression()); - } - - /** * An expression of an inbound message body */ public T body() { @@ -105,20 +98,6 @@ public class MockExpressionClauseSupport<T> { } /** - * An expression of an outbound message body - */ - public T outBody() { - return expression(ExpressionBuilder.outBodyExpression()); - } - - /** - * An expression of an outbound message body converted to the expected type - */ - public T outBody(Class<?> expectedType) { - return expression(ExpressionBuilder.outBodyExpression(expectedType)); - } - - /** * An expression of an inbound message header of the given name */ public T header(String name) { @@ -133,20 +112,6 @@ public class MockExpressionClauseSupport<T> { } /** - * An expression of an outbound message header of the given name - */ - public T outHeader(String name) { - return expression(ExpressionBuilder.outHeaderExpression(name)); - } - - /** - * An expression of the outbound headers - */ - public T outHeaders() { - return expression(ExpressionBuilder.outHeadersExpression()); - } - - /** * An expression of the exchange pattern */ public T exchangePattern() { diff --git a/core/camel-api/src/main/java/org/apache/camel/OutHeaders.java b/core/camel-api/src/main/java/org/apache/camel/OutHeaders.java deleted file mode 100644 index 41f711a..0000000 --- a/core/camel-api/src/main/java/org/apache/camel/OutHeaders.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Marks a parameter as being an injection point of the headers of an outbound {@link Message} - * - * @see Message#getHeaders() - */ -@Retention(RetentionPolicy.RUNTIME) -@Documented -@Target({ElementType.PARAMETER }) -public @interface OutHeaders { -} \ No newline at end of file diff --git a/core/camel-base/src/main/docs/simple-language.adoc b/core/camel-base/src/main/docs/simple-language.adoc index 4366e30..ab07cc6 100644 --- a/core/camel-base/src/main/docs/simple-language.adoc +++ b/core/camel-base/src/main/docs/simple-language.adoc @@ -86,8 +86,6 @@ classname, and expects the body to be not null. |mandatoryBodyAs(_type_).*OGNL* |Object |Converts the body to the given type determined by its classname and then invoke methods using a Camel OGNL expression. -|out.body |Object |*deprecated* the output body - |header.foo |Object |refer to the input foo header |header:foo |Object |refer to the input foo header @@ -130,18 +128,6 @@ Camel OGNL expression. |in.headers.foo.*OGNL* |Object |*deprecated* refer to the input foo header and invoke its value using a Camel OGNL expression. -|out.header.foo |Object |*deprecated* refer to the out header foo - -|out.header:foo |Object |*deprecated* refer to the out header foo - -|out.header[foo] |Object |*deprecated* refer to the out header foo - -|out.headers.foo |Object |*deprecated* refer to the out header foo - -|out.headers:foo |Object |*deprecated* refer to the out header foo - -|out.headers[foo] |Object |*deprecated* refer to the out header foo - |headerAs(_key_,_type_) |Type |converts the header to the given type determined by its classname diff --git a/core/camel-base/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java b/core/camel-base/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java index c0a0575..adabcdc 100644 --- a/core/camel-base/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java +++ b/core/camel-base/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java @@ -368,29 +368,12 @@ public class SimpleFunctionExpression extends LiteralExpression { } } - // out header function - remainder = ifStartsWithReturnRemainder("out.header.", function); - if (remainder == null) { - remainder = ifStartsWithReturnRemainder("out.header:", function); - } - if (remainder == null) { - remainder = ifStartsWithReturnRemainder("out.headers.", function); - } - if (remainder == null) { - remainder = ifStartsWithReturnRemainder("out.headers:", function); - } - if (remainder != null) { - return ExpressionBuilder.outHeaderExpression(remainder); - } - return null; } private Expression createSimpleExpressionDirectly(String expression) { if (ObjectHelper.isEqualToAny(expression, "body", "in.body")) { return ExpressionBuilder.bodyExpression(); - } else if (ObjectHelper.equal(expression, "out.body")) { - return ExpressionBuilder.outBodyExpression(); } else if (ObjectHelper.equal(expression, "bodyOneLine")) { return ExpressionBuilder.bodyOneLine(); } else if (ObjectHelper.equal(expression, "id")) { diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java b/core/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java index b5b4d24..cdef4c2 100644 --- a/core/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java +++ b/core/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java @@ -112,25 +112,6 @@ public class ExpressionClause<T> implements Expression, Predicate { } /** - * An expression of an outbound message - */ - public T outMessage() { - return delegate.outMessage(); - } - - /** - * A functional expression of an outbound message - */ - @Deprecated - public T outMessage(final Function<Message, Object> function) { - return delegate.expression(new ExpressionAdapter() { - public Object evaluate(Exchange exchange) { - return function.apply(exchange.getOut()); - } - }); - } - - /** * An expression of an inbound message body */ public T body() { @@ -204,72 +185,6 @@ public class ExpressionClause<T> implements Expression, Predicate { } /** - * An expression of an outbound message body - */ - public T outBody() { - return delegate.outBody(); - } - - /** - * A functional expression of an outbound message body - */ - @Deprecated - public T outBody(final Function<Object, Object> function) { - return delegate.expression(new ExpressionAdapter() { - public Object evaluate(Exchange exchange) { - return function.apply(exchange.getOut().getBody()); - } - }); - } - - /** - * A functional expression of an outbound message body and headers - */ - @Deprecated - public T outBody(final BiFunction<Object, Map<String, Object>, Object> function) { - return delegate.expression(new ExpressionAdapter() { - public Object evaluate(Exchange exchange) { - return function.apply( - exchange.getOut().getBody(), - exchange.getOut().getHeaders()); - } - }); - } - - /** - * An expression of an outbound message body converted to the expected type - */ - public T outBody(Class<?> expectedType) { - return delegate.outBody(expectedType); - } - - /** - * A functional expression of an outbound message body converted to the expected type - */ - @Deprecated - public <B> T outBody(Class<B> expectedType, final Function<B, Object> function) { - return delegate.expression(new ExpressionAdapter() { - public Object evaluate(Exchange exchange) { - return function.apply(exchange.getOut().getBody(expectedType)); - } - }); - } - - /** - * A functional expression of an outbound message body converted to the expected type and headers - */ - @Deprecated - public <B> T outBody(Class<B> expectedType, final BiFunction<B, Map<String, Object>, Object> function) { - return delegate.expression(new ExpressionAdapter() { - public Object evaluate(Exchange exchange) { - return function.apply( - exchange.getOut().getBody(expectedType), - exchange.getOut().getHeaders()); - } - }); - } - - /** * An expression of an inbound message header of the given name */ public T header(String name) { @@ -284,20 +199,6 @@ public class ExpressionClause<T> implements Expression, Predicate { } /** - * An expression of an outbound message header of the given name - */ - public T outHeader(String name) { - return delegate.outHeader(name); - } - - /** - * An expression of the outbound headers - */ - public T outHeaders() { - return delegate.outHeaders(); - } - - /** * An expression of an exchange property of the given name */ public T exchangeProperty(String name) { diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java b/core/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java index 1693722..6ba1a5c 100644 --- a/core/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java +++ b/core/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java @@ -107,13 +107,6 @@ public class ExpressionClauseSupport<T> { } /** - * An expression of an inbound message - */ - public T outMessage() { - return expression(ExpressionBuilder.outMessageExpression()); - } - - /** * An expression of an inbound message body */ public T body() { @@ -129,20 +122,6 @@ public class ExpressionClauseSupport<T> { } /** - * An expression of an outbound message body - */ - public T outBody() { - return expression(ExpressionBuilder.outBodyExpression()); - } - - /** - * An expression of an outbound message body converted to the expected type - */ - public T outBody(Class<?> expectedType) { - return expression(ExpressionBuilder.outBodyExpression(expectedType)); - } - - /** * An expression of an inbound message header of the given name */ public T header(String name) { @@ -157,20 +136,6 @@ public class ExpressionClauseSupport<T> { } /** - * An expression of an outbound message header of the given name - */ - public T outHeader(String name) { - return expression(ExpressionBuilder.outHeaderExpression(name)); - } - - /** - * An expression of the outbound headers - */ - public T outHeaders() { - return expression(ExpressionBuilder.outHeadersExpression()); - } - - /** * An expression of the exchange pattern */ public T exchangePattern() { diff --git a/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithHeadersAndBodyInject3Test.java b/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithHeadersAndBodyInject3Test.java index 1564df8..c7e2ad5 100644 --- a/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithHeadersAndBodyInject3Test.java +++ b/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithHeadersAndBodyInject3Test.java @@ -23,7 +23,6 @@ import javax.naming.Context; import org.apache.camel.Body; import org.apache.camel.ContextTestSupport; import org.apache.camel.Headers; -import org.apache.camel.OutHeaders; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.support.jndi.JndiContext; @@ -44,7 +43,6 @@ public class BeanWithHeadersAndBodyInject3Test extends ContextTestSupport { public void testInOnly() throws Exception { MockEndpoint end = getMockEndpoint("mock:finish"); end.expectedBodiesReceived("Hello!"); - end.message(0).header("out").isNull(); sendBody("direct:start", "Test Input"); @@ -79,12 +77,8 @@ public class BeanWithHeadersAndBodyInject3Test extends ContextTestSupport { public static class MyBean { - public String doSomething(@Body String body, @Headers Map<?, ?> headers, - @OutHeaders Map<String, Object> outHeaders) { - if (outHeaders != null) { - outHeaders.put("out", 123); - } - + public String doSomething(@Body String body, @Headers Map headers) { + headers.put("out", 123); return "Hello!"; } } diff --git a/core/camel-core/src/test/java/org/apache/camel/component/mock/MockPredicateTest.java b/core/camel-core/src/test/java/org/apache/camel/component/mock/MockPredicateTest.java index 3cce51a..d0ed558 100644 --- a/core/camel-core/src/test/java/org/apache/camel/component/mock/MockPredicateTest.java +++ b/core/camel-core/src/test/java/org/apache/camel/component/mock/MockPredicateTest.java @@ -49,22 +49,6 @@ public class MockPredicateTest extends ContextTestSupport { assertMockEndpointsSatisfied(); } - @Test - public void testOutBodyType() throws Exception { - MockEndpoint mock = getMockEndpoint("mock:foo"); - mock.message(0).outBody(String.class).isEqualTo("Bye World"); - mock.expectedMessageCount(1); - - template.send("direct:start", new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("Hello World"); - exchange.getOut().setBody("Bye World"); - } - }); - - assertMockEndpointsSatisfied(); - } - @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { diff --git a/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java b/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java index 529f8e0..af249ed 100644 --- a/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java +++ b/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java @@ -243,17 +243,6 @@ public class SimpleTest extends LanguageTestSupport { } @Test - public void testSimpleOutExpressions() throws Exception { - exchange.getOut().setBody("Bye World"); - exchange.getOut().setHeader("quote", "Camel rocks"); - assertExpression("${out.body}", "Bye World"); - assertExpression("${out.header.quote}", "Camel rocks"); - assertExpression("${out.header:quote}", "Camel rocks"); - assertExpression("${out.headers.quote}", "Camel rocks"); - assertExpression("${out.headers:quote}", "Camel rocks"); - } - - @Test public void testSimpleExchangePropertyExpressions() throws Exception { exchange.setProperty("medal", "gold"); assertExpression("${exchangeProperty.medal}", "gold"); @@ -576,10 +565,6 @@ public class SimpleTest extends LanguageTestSupport { assertExpression("${date:in.header.birthday:yyyyMMdd}", "19740420"); assertExpression("${date:in.header.birthday+24h:yyyyMMdd}", "19740421"); - assertExpression("${date:out.header.birthday}", outHeaderCalendar.getTime()); - assertExpression("${date:out.header.birthday:yyyyMMdd}", "19750521"); - assertExpression("${date:out.header.birthday+24h:yyyyMMdd}", "19750522"); - assertExpression("${date:exchangeProperty.birthday}", propertyCalendar.getTime()); assertExpression("${date:exchangeProperty.birthday:yyyyMMdd}", "19760622"); assertExpression("${date:exchangeProperty.birthday+24h:yyyyMMdd}", "19760623"); diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelHandledExampleTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelHandledExampleTest.java index 3b6845f..1c867f0 100644 --- a/core/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelHandledExampleTest.java +++ b/core/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelHandledExampleTest.java @@ -21,7 +21,6 @@ import java.util.Map; import org.apache.camel.Body; import org.apache.camel.ContextTestSupport; import org.apache.camel.Headers; -import org.apache.camel.OutHeaders; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.junit.Test; @@ -100,33 +99,31 @@ public class DeadLetterChannelHandledExampleTest extends ContextTestSupport { /** * This method handle our order input and return the order * - * @param in the in headers + * @param headers the in headers * @param payload the in payload - * @param out the out headers * @return the out payload * @throws OrderFailedException is thrown if the order cannot be processed */ - public Object handleOrder(@Headers Map<?, ?> in, @Body String payload, @OutHeaders Map<String, Object> out) + public Object handleOrder(@Headers Map headers, @Body String payload) throws OrderFailedException { - out.put("customerid", in.get("customerid")); + headers.put("customerid", headers.get("customerid")); if ("Order: kaboom".equals(payload)) { throw new OrderFailedException("Cannot order: kaboom"); } else { - out.put("orderid", "123"); + headers.put("orderid", "123"); return "Order OK"; } } /** * This method creates the response to the caller if the order could not be processed - * @param in the in headers + * @param headers the in headers * @param payload the in payload - * @param out the out headers * @return the out payload */ - public Object orderFailed(@Headers Map<?, ?> in, @Body String payload, @OutHeaders Map<String, Object> out) { - out.put("customerid", in.get("customerid")); - out.put("orderid", "failed"); + public Object orderFailed(@Headers Map headers, @Body String payload) { + headers.put("customerid", headers.get("customerid")); + headers.put("orderid", "failed"); return "Order ERROR"; } } diff --git a/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java b/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java index 20f3ff8..ef8abc9 100644 --- a/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java +++ b/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java @@ -167,64 +167,6 @@ public class ExpressionBuilder { } /** - * Returns an expression for the out header value with the given name - * <p/> - * Will fallback and look in properties if not found in headers. - * - * @param headerName the name of the header the expression will return - * @return an expression object which will return the header value - */ - @Deprecated - public static Expression outHeaderExpression(final String headerName) { - return new ExpressionAdapter() { - public Object evaluate(Exchange exchange) { - if (!exchange.hasOut()) { - return null; - } - - String text = simpleExpression(headerName).evaluate(exchange, String.class); - Message out = exchange.getOut(); - Object header = out.getHeader(text); - if (header == null) { - // let's try the exchange header - header = exchange.getProperty(text); - } - return header; - } - - @Override - public String toString() { - return "outHeader(" + headerName + ")"; - } - }; - } - - /** - * Returns an expression for the outbound message headers - * - * @return an expression object which will return the headers, will be <tt>null</tt> if the - * exchange is not out capable. - */ - @Deprecated - public static Expression outHeadersExpression() { - return new ExpressionAdapter() { - public Object evaluate(Exchange exchange) { - // only get out headers if the MEP is out capable - if (ExchangeHelper.isOutCapable(exchange)) { - return exchange.getOut().getHeaders(); - } else { - return null; - } - } - - @Override - public String toString() { - return "outHeaders"; - } - }; - } - - /** * Returns an expression for the exchange pattern * * @see Exchange#getPattern() @@ -866,49 +808,6 @@ public class ExpressionBuilder { } /** - * Returns the expression for the out messages body - */ - @Deprecated - public static Expression outBodyExpression() { - return new ExpressionAdapter() { - public Object evaluate(Exchange exchange) { - if (exchange.hasOut()) { - return exchange.getOut().getBody(); - } else { - return null; - } - } - - @Override - public String toString() { - return "outBody"; - } - }; - } - - /** - * Returns the expression for the exchanges outbound message body converted - * to the given type - */ - @Deprecated - public static <T> Expression outBodyExpression(final Class<T> type) { - return new ExpressionAdapter() { - public Object evaluate(Exchange exchange) { - if (exchange.hasOut()) { - return exchange.getOut().getBody(type); - } else { - return null; - } - } - - @Override - public String toString() { - return "outBodyAs[" + type.getName() + "]"; - } - }; - } - - /** * Returns the expression for the exchange */ public static Expression exchangeExpression() { @@ -987,40 +886,6 @@ public class ExpressionBuilder { } /** - * Returns the expression for the OUT message - */ - @Deprecated - public static Expression outMessageExpression() { - return new ExpressionAdapter() { - public Object evaluate(Exchange exchange) { - return exchange.getOut(); - } - - @Override - public String toString() { - return "outMessage"; - } - }; - } - - /** - * Returns a functional expression for the OUT message - */ - @Deprecated - public static Expression outMessageExpression(final Function<Message, Object> function) { - return new ExpressionAdapter() { - public Object evaluate(Exchange exchange) { - return function.apply(exchange.getOut()); - } - - @Override - public String toString() { - return "outMessageExpression"; - } - }; - } - - /** * Returns an expression which converts the given expression to the given type */ public static Expression convertToExpression(final Expression expression, final Class<?> type) {
