[
https://issues.apache.org/jira/browse/CAMEL-7831?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15465349#comment-15465349
]
Luca Burgazzoli edited comment on CAMEL-7831 at 9/5/16 4:21 PM:
----------------------------------------------------------------
I've enhanced ExpressionClause so you have:
{code:java}
/**
* transform().function(e -> e.getProperty("some prop"))
*/
public T function(final ExchangeFunction function);
/**
* transform().function(m -> m.getHeader("key"))
*/
public T inFunction(final MessageFunction function);
/**
* transform().function(m -> m.getHeader("key"))
*/
public T outFunction(final MessageFunction function);
{code}
We could create some more functional interface like
{code:java}
interface BodyFunction extends BiFunction<Object, Map<String, Object>,
Object> {
}
{code}
was (Author: lb):
I've enhanced ExpressionClause so you have:
{code:java}
/**
* transform().function(e -> e.getProperty("some prop"))
*/
public T function(final ExchangeFunction function);
/**
* transform().function(m -> m.getHeader("key"))
*/
public T inFunction(final MessageFunction function);
/**
* transform().function(m -> m.getHeader("key"))
*/
public T outFunction(final MessageFunction function);
{code}
We could create some more functional interface like
{code:java}
interface BodyFunction extends BiFunction<Object, Map<String, Object> {
}
{code}
> create a java8 only demo showing how to use lambda expressions for Predicate
> / Expression inside the Java DSL (using Message as a typesafe parameter)
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-7831
> URL: https://issues.apache.org/jira/browse/CAMEL-7831
> Project: Camel
> Issue Type: New Feature
> Components: examples
> Reporter: james strachan
> Assignee: Luca Burgazzoli
> Fix For: 2.18.0
>
>
> e.g. so folks can type things like
> {code}
> from("seda:cheese").
> filter(m -> m.getHeader("foo", int.class) > 5).
> map(m -> createPurchaseOrder(m.getBody(Invoice.class)).
> to("seda:bar");
> {code}
> Note if the current Predicate/Expression classes don't work as lambdas we
> could add a new interface with a single method to the DSL to ensure Java 8
> does the right thing with lambdas
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)