camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gzurow...@apache.org
Subject [camel] branch master updated: [Minor] Use lambda expressions
Date Mon, 08 Apr 2019 07:16:32 GMT
This is an automated email from the ASF dual-hosted git repository.

gzurowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 412f897  [Minor] Use lambda expressions
412f897 is described below

commit 412f897c7d0edcdc74aed05d8172da227cb9c082
Author: Gregor Zurowski <gregor@zurowski.org>
AuthorDate: Mon Apr 8 09:14:46 2019 +0200

    [Minor] Use lambda expressions
---
 .../org/apache/camel/converter/CamelConverter.java | 25 +++++++++-------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/core/camel-base/src/main/java/org/apache/camel/converter/CamelConverter.java
b/core/camel-base/src/main/java/org/apache/camel/converter/CamelConverter.java
index 405fe37..c774a7b 100644
--- a/core/camel-base/src/main/java/org/apache/camel/converter/CamelConverter.java
+++ b/core/camel-base/src/main/java/org/apache/camel/converter/CamelConverter.java
@@ -17,7 +17,6 @@
 package org.apache.camel.converter;
 
 import org.apache.camel.Converter;
-import org.apache.camel.Exchange;
 import org.apache.camel.Expression;
 import org.apache.camel.Message;
 import org.apache.camel.Predicate;
@@ -38,26 +37,22 @@ public final class CamelConverter {
 
     @Converter
     public static Processor toProcessor(final Predicate predicate) {
-        return new Processor() {
-            public void process(Exchange exchange) throws Exception {
-                boolean answer = predicate.matches(exchange);
-                Message out = exchange.getOut();
-                out.copyFrom(exchange.getIn());
-                out.setBody(answer);
-            }
+        return exchange -> {
+            boolean answer = predicate.matches(exchange);
+            Message out = exchange.getOut();
+            out.copyFrom(exchange.getIn());
+            out.setBody(answer);
         };
 
     }
 
     @Converter
     public static Processor toProcessor(final Expression expression) {
-        return new Processor() {
-            public void process(Exchange exchange) throws Exception {
-                Object answer = expression.evaluate(exchange, Object.class);
-                Message out = exchange.getOut();
-                out.copyFrom(exchange.getIn());
-                out.setBody(answer);
-            }
+        return exchange -> {
+            Object answer = expression.evaluate(exchange, Object.class);
+            Message out = exchange.getOut();
+            out.copyFrom(exchange.getIn());
+            out.setBody(answer);
         };
     }
 


Mime
View raw message