camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: CAMEL-11366: Polished code a bit
Date Thu, 01 Jun 2017 08:50:33 GMT
Repository: camel
Updated Branches:
  refs/heads/master 67372dd8e -> b3ca9219f


CAMEL-11366: Polished code a bit


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ba91b0db
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ba91b0db
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ba91b0db

Branch: refs/heads/master
Commit: ba91b0db221d7f138312cb4450431ae96c1087e3
Parents: 67372dd
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu Jun 1 10:12:34 2017 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu Jun 1 10:12:34 2017 +0200

----------------------------------------------------------------------
 .../camel/language/bean/BeanExpression.java     | 22 ++++++++++++--------
 1 file changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ba91b0db/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java b/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java
index eaa7607..3b70cd8 100644
--- a/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java
+++ b/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java
@@ -110,7 +110,7 @@ public class BeanExpression implements Expression, Predicate {
 
         if (OgnlHelper.isValidOgnlExpression(method)) {
             // okay the method is an ognl expression
-            OgnlInvokeProcessor ognl = new OgnlInvokeProcessor(beanHolder, method);
+            OgnlInvokeProcessor ognl = new OgnlInvokeProcessor(beanHolder, beanName, method);
             try {
                 ognl.process(exchange);
                 return ognl.getResult();
@@ -122,7 +122,7 @@ public class BeanExpression implements Expression, Predicate {
             }
         } else {
             // regular non ognl invocation
-            InvokeProcessor invoke = new InvokeProcessor(beanHolder, method);
+            InvokeProcessor invoke = new InvokeProcessor(beanHolder, beanName, method);
             try {
                 invoke.process(exchange);
                 return invoke.getResult();
@@ -183,15 +183,17 @@ public class BeanExpression implements Expression, Predicate {
     /**
      * Invokes a given bean holder. The method name is optional.
      */
-    private final class InvokeProcessor implements Processor {
+    private static final class InvokeProcessor implements Processor {
 
-        private BeanHolder beanHolder;
-        private String methodName;
+        private final BeanHolder beanHolder;
+        private final String methodName;
+        private final String beanName;
         private Object result;
 
-        private InvokeProcessor(BeanHolder beanHolder, String methodName) {
+        private InvokeProcessor(BeanHolder beanHolder, String beanName, String methodName)
{
             this.beanHolder = beanHolder;
             this.methodName = methodName;
+            this.beanName = beanName;
         }
 
         public void process(Exchange exchange) throws Exception {
@@ -240,14 +242,16 @@ public class BeanExpression implements Expression, Predicate {
      * For more advanced OGNL you may have to look for a real framework such as OGNL, Mvel
or dynamic
      * programming language such as Groovy, JuEL, JavaScript.
      */
-    private final class OgnlInvokeProcessor implements Processor {
+    private static final class OgnlInvokeProcessor implements Processor {
 
         private final String ognl;
         private final BeanHolder beanHolder;
+        private final String beanName;
         private Object result;
 
-        OgnlInvokeProcessor(BeanHolder beanHolder, String ognl) {
+        private OgnlInvokeProcessor(BeanHolder beanHolder, String beanName, String ognl)
{
             this.beanHolder = beanHolder;
+            this.beanName = beanName;
             this.ognl = ognl;
             // we must start with having bean as the result
             this.result = beanHolder.getBean();
@@ -319,7 +323,7 @@ public class BeanExpression implements Expression, Predicate {
 
                 // only invoke if we have a method name to use to invoke
                 if (methodName != null) {
-                    InvokeProcessor invoke = new InvokeProcessor(holder, methodName);
+                    InvokeProcessor invoke = new InvokeProcessor(holder, beanName, methodName);
                     invoke.process(resultExchange);
 
                     // check for exception and rethrow if we failed


Mime
View raw message