You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2018/03/09 16:17:44 UTC

[camel] branch master updated: CAMEL-12339: Add jsonpath to RouteBuilder

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


The following commit(s) were added to refs/heads/master by this push:
     new c5818a8  CAMEL-12339: Add jsonpath to RouteBuilder
c5818a8 is described below

commit c5818a83344a1993ab40bafe13028c22dd88a7a1
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Mar 9 17:17:32 2018 +0100

    CAMEL-12339: Add jsonpath to RouteBuilder
---
 .../org/apache/camel/builder/BuilderSupport.java   | 33 ++++++++++++++++++----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java b/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
index f12d32e..ea81d2c 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
@@ -29,6 +29,7 @@ import org.apache.camel.builder.xml.XPathBuilder;
 import org.apache.camel.model.ModelCamelContext;
 import org.apache.camel.model.language.ExchangePropertyExpression;
 import org.apache.camel.model.language.HeaderExpression;
+import org.apache.camel.model.language.JsonPathExpression;
 import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -169,6 +170,26 @@ public abstract class BuilderSupport {
     }
 
     /**
+     * Returns a JSonPath expression value builder
+     */
+    public ValueBuilder jsonpath(String value) {
+        JsonPathExpression exp = new JsonPathExpression(value);
+        return new ValueBuilder(exp);
+    }
+
+    /**
+     * Returns a JSonPath expression value builder
+     *
+     * @param value      The JSonPath expression
+     * @param resultType The result type that the JSonPath expression will return.
+     */
+    public ValueBuilder jsonpath(String value, Class<?> resultType) {
+        JsonPathExpression exp = new JsonPathExpression(value);
+        exp.setResultType(resultType);
+        return new ValueBuilder(exp);
+    }
+
+    /**
      * Returns a language expression value builder
      */
     public ValueBuilder language(String language, String expression) {
@@ -205,8 +226,9 @@ public abstract class BuilderSupport {
 
     /**
      * Returns a xpath expression value builder
-     * @param value The XPath expression
-     * @return A new XPathBuilder object
+     *
+     * @param value the XPath expression
+     * @return the builder
      */
     public XPathBuilder xpath(String value) {
         return XPathBuilder.xpath(value);
@@ -214,9 +236,10 @@ public abstract class BuilderSupport {
 
     /**
      * Returns a xpath expression value builder
-     * @param value The XPath expression
-     * @param resultType The result type that the XPath expression will return.
-     * @return A new XPathBuilder object
+     *
+     * @param value      the XPath expression
+     * @param resultType the result type that the XPath expression will return.
+     * @return the builder
      */
     public static XPathBuilder xpath(String value, Class<?> resultType) {
         return XPathBuilder.xpath(value, resultType);

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.