Package org.apache.synapse.util.xpath
Class SynapseJsonPath
- java.lang.Object
-
- org.jaxen.BaseXPath
-
- org.apache.axiom.om.xpath.AXIOMXPath
-
- org.apache.synapse.config.xml.SynapsePath
-
- org.apache.synapse.util.xpath.SynapseJsonPath
-
- All Implemented Interfaces:
Serializable,org.jaxen.XPath
public class SynapseJsonPath extends SynapsePath
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.synapse.config.xml.SynapsePath
bufferSizeSupport, contentAware, domNamespaceMap, expression, JSON_PATH, X_PATH
-
-
Constructor Summary
Constructors Constructor Description SynapseJsonPath(String jsonPathExpression)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanbooleanValueOf(MessageContext synCtx)This method will return the boolean value of the jsonpath.Objectevaluate(Object object)Read the JSON Stream and returns a list of objects using the jsonPath.com.jayway.jsonpath.JsonPathgetJsonPath()StringgetJsonPathExpression()StringgetParentPath()booleanisWholeBody()Getter method for isWholeBodyObjectreplace(Object rootObject, Object newChild)Replaces first matching item with a given child object.voidsetJsonPath(com.jayway.jsonpath.JsonPath jsonPath)voidsetJsonPathExpression(String jsonPathExpression)StringstringValueOf(InputStream jsonStream)StringstringValueOf(String jsonString)StringstringValueOf(MessageContext synCtx)-
Methods inherited from class org.apache.synapse.config.xml.SynapsePath
addNamespacesForFallbackProcessing, getExpression, getMessageInputStreamPT, getPathType, handleException, isContentAware, isMessageBiggerThanBuffer, setExpression, setPathType, toString
-
Methods inherited from class org.apache.axiom.om.xpath.AXIOMXPath
addNamespace, addNamespaces, getNamespaces
-
Methods inherited from class org.jaxen.BaseXPath
booleanValueOf, createFunctionContext, createNamespaceContext, createVariableContext, debug, getContext, getContextSupport, getFunctionContext, getNamespaceContext, getNavigator, getRootExpr, getVariableContext, numberValueOf, selectNodes, selectNodesForContext, selectSingleNode, selectSingleNodeForContext, setFunctionContext, setNamespaceContext, setVariableContext, stringValueOf, valueOf
-
-
-
-
Constructor Detail
-
SynapseJsonPath
public SynapseJsonPath(String jsonPathExpression) throws org.jaxen.JaxenException
- Throws:
org.jaxen.JaxenException
-
-
Method Detail
-
getJsonPath
public com.jayway.jsonpath.JsonPath getJsonPath()
-
getParentPath
public String getParentPath()
-
setJsonPath
public void setJsonPath(com.jayway.jsonpath.JsonPath jsonPath)
-
stringValueOf
public String stringValueOf(MessageContext synCtx)
- Specified by:
stringValueOfin classSynapsePath
-
stringValueOf
public String stringValueOf(InputStream jsonStream)
-
getJsonPathExpression
public String getJsonPathExpression()
-
setJsonPathExpression
public void setJsonPathExpression(String jsonPathExpression)
-
evaluate
public Object evaluate(Object object)
Read the JSON Stream and returns a list of objects using the jsonPath.- Specified by:
evaluatein interfaceorg.jaxen.XPath- Overrides:
evaluatein classorg.jaxen.BaseXPath
-
replace
public Object replace(Object rootObject, Object newChild)
Replaces first matching item with a given child object. Updated root object will be return back to the caller- Parameters:
rootObject- Root JSON Object or ArraynewChild- New jsonObject to replace- Returns:
- Updated Root Object
-
isWholeBody
public boolean isWholeBody()
Getter method for isWholeBody- Returns:
- returns true if jsonPath expression is $ or $
-
booleanValueOf
public boolean booleanValueOf(MessageContext synCtx)
This method will return the boolean value of the jsonpath.- Parameters:
synCtx- message context- Returns:
- boolean value
-
-