Package org.apache.camel.jsonpath
Class JsonPathExpression
- java.lang.Object
-
- org.apache.camel.support.ExpressionSupport
-
- org.apache.camel.support.ExpressionAdapter
-
- org.apache.camel.jsonpath.JsonPathExpression
-
- All Implemented Interfaces:
org.apache.camel.Expression,org.apache.camel.Predicate
public class JsonPathExpression extends org.apache.camel.support.ExpressionAdapter
-
-
Constructor Summary
Constructors Constructor Description JsonPathExpression(String expression)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectevaluate(org.apache.camel.Exchange exchange)StringgetHeaderName()com.jayway.jsonpath.Option[]getOptions()StringgetPropertyName()Class<?>getResultType()voidinit(org.apache.camel.CamelContext context)booleanisAllowEasyPredicate()booleanisAllowSimple()booleanisPredicate()booleanisSuppressExceptions()booleanisUnpackArray()booleanisWriteAsString()voidsetAllowEasyPredicate(boolean allowEasyPredicate)Whether to allow using the easy predicate parser to pre-parse predicates.voidsetAllowSimple(boolean allowSimple)Whether to allow in inlined simple exceptions in the json path expressionvoidsetHeaderName(String headerName)Name of header to use as input, instead of the message bodyvoidsetOptions(com.jayway.jsonpath.Option[] options)To configure the json path options to usevoidsetPredicate(boolean predicate)Whether to be evaluated as a predicatevoidsetPropertyName(String propertyName)Name of property to use as input, instead of the message body.voidsetResultType(Class<?> resultType)To configure the result type to usevoidsetSuppressExceptions(boolean suppressExceptions)Whether to suppress exceptions such as PathNotFoundExceptionvoidsetUnpackArray(boolean unpackArray)Whether to unpack a single element json-array into an object.voidsetWriteAsString(boolean writeAsString)Whether to write the output of each row/element as a JSON String value instead of a Map/POJO value.StringtoString()-
Methods inherited from class org.apache.camel.support.ExpressionAdapter
assertionFailureMessage, evaluate
-
-
-
-
Constructor Detail
-
JsonPathExpression
public JsonPathExpression(String expression)
-
-
Method Detail
-
isPredicate
public boolean isPredicate()
-
setPredicate
public void setPredicate(boolean predicate)
Whether to be evaluated as a predicate
-
getResultType
public Class<?> getResultType()
-
setResultType
public void setResultType(Class<?> resultType)
To configure the result type to use
-
isSuppressExceptions
public boolean isSuppressExceptions()
-
setSuppressExceptions
public void setSuppressExceptions(boolean suppressExceptions)
Whether to suppress exceptions such as PathNotFoundException
-
isAllowSimple
public boolean isAllowSimple()
-
setAllowSimple
public void setAllowSimple(boolean allowSimple)
Whether to allow in inlined simple exceptions in the json path expression
-
isAllowEasyPredicate
public boolean isAllowEasyPredicate()
-
setAllowEasyPredicate
public void setAllowEasyPredicate(boolean allowEasyPredicate)
Whether to allow using the easy predicate parser to pre-parse predicates. SeeEasyPredicateParserfor more details.
-
isWriteAsString
public boolean isWriteAsString()
-
setWriteAsString
public void setWriteAsString(boolean writeAsString)
Whether to write the output of each row/element as a JSON String value instead of a Map/POJO value.
-
isUnpackArray
public boolean isUnpackArray()
-
setUnpackArray
public void setUnpackArray(boolean unpackArray)
Whether to unpack a single element json-array into an object.
-
getHeaderName
public String getHeaderName()
-
setHeaderName
public void setHeaderName(String headerName)
Name of header to use as input, instead of the message body
-
getPropertyName
public String getPropertyName()
-
setPropertyName
public void setPropertyName(String propertyName)
Name of property to use as input, instead of the message body.It has a lower precedent than the name of header if both are set.
-
getOptions
public com.jayway.jsonpath.Option[] getOptions()
-
setOptions
public void setOptions(com.jayway.jsonpath.Option[] options)
To configure the json path options to use
-
evaluate
public Object evaluate(org.apache.camel.Exchange exchange)
- Overrides:
evaluatein classorg.apache.camel.support.ExpressionSupport
-
init
public void init(org.apache.camel.CamelContext context)
- Specified by:
initin interfaceorg.apache.camel.Expression- Specified by:
initin interfaceorg.apache.camel.Predicate- Overrides:
initin classorg.apache.camel.support.ExpressionAdapter
-
-