Class JsonPathServiceImpl
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.path.json.JsonPathServiceImpl
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
,Service
,StateManagedComponent
- Direct Known Subclasses:
JsonPathService
public abstract class JsonPathServiceImpl extends ServiceImp
This is the base for JSON path services, which allows you to search JSON content with the results then being set back into the message.The searching works in much the same way as XPath, for more information on how to build a JSON path see the JSONPath documentation.
See individual implementations for further documentation.
-
-
Field Summary
Fields Modifier and Type Field Description protected @NotNull @Valid @NonNull java.util.List<Execution>
executions
The list of jsonpath executions to apply.protected java.lang.Boolean
unwrapJson
Get whether the JSON should be unwrapped removing any leading or trailing square brackets[]
.-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description JsonPathServiceImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeService()
protected static java.lang.Object
convertIfNull(java.lang.Object o, Execution exec)
@NonNull java.util.List<Execution>
getExecutions()
The list of jsonpath executions to apply.java.lang.Boolean
getUnwrapJson()
Get whether the JSON should be unwrapped removing any leading or trailing square brackets[]
.protected void
initService()
void
setExecutions(@NonNull java.util.List<Execution> executions)
The list of jsonpath executions to apply.void
setUnwrapJson(java.lang.Boolean unwrapJson)
Get whether the JSON should be unwrapped removing any leading or trailing square brackets[]
.protected boolean
suppressPathNotFound(Execution exec)
protected static java.lang.String
toString(java.lang.Object json, Execution exec)
protected static java.lang.String
unwrap(java.lang.String json, boolean unwrapJson)
Strip (if necessary) the leading/trailing [] from the JSON.protected boolean
unwrapJson()
-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId, start, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.ComponentLifecycleExtension
prepare
-
-
-
-
Field Detail
-
executions
@NotNull @Valid @NonNull protected @NotNull @Valid @NonNull java.util.List<Execution> executions
The list of jsonpath executions to apply.
-
unwrapJson
protected java.lang.Boolean unwrapJson
Get whether the JSON should be unwrapped removing any leading or trailing square brackets[]
.The default is false if not specified.
-
-
Method Detail
-
toString
protected static java.lang.String toString(java.lang.Object json, Execution exec) throws java.lang.Exception
- Throws:
java.lang.Exception
-
unwrap
protected static java.lang.String unwrap(java.lang.String json, boolean unwrapJson)
Strip (if necessary) the leading/trailing [] from the JSON.- Parameters:
json
- The JSON string.
-
closeService
protected void closeService()
- Specified by:
closeService
in classServiceImp
-
initService
protected void initService() throws CoreException
- Specified by:
initService
in classServiceImp
- Throws:
CoreException
-
unwrapJson
protected boolean unwrapJson()
-
suppressPathNotFound
protected boolean suppressPathNotFound(Execution exec)
-
convertIfNull
protected static java.lang.Object convertIfNull(java.lang.Object o, Execution exec)
-
getExecutions
@NonNull public @NonNull java.util.List<Execution> getExecutions()
The list of jsonpath executions to apply.
-
setExecutions
public void setExecutions(@NonNull @NonNull java.util.List<Execution> executions)
The list of jsonpath executions to apply.
-
getUnwrapJson
public java.lang.Boolean getUnwrapJson()
Get whether the JSON should be unwrapped removing any leading or trailing square brackets[]
.The default is false if not specified.
-
setUnwrapJson
public void setUnwrapJson(java.lang.Boolean unwrapJson)
Get whether the JSON should be unwrapped removing any leading or trailing square brackets[]
.The default is false if not specified.
-
-