public class JsonPathPathUtilsDefault extends Object implements JsonPathUtils
| Modifier and Type | Class and Description |
|---|---|
protected static class |
JsonPathPathUtilsDefault.JsonPathProcessingType |
| Constructor and Description |
|---|
JsonPathPathUtilsDefault(SpincastConfig spincastConfig,
JsonManager jsonManager)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
Object |
getElementAtJsonPath(JsonArray array,
String jsonPath)
Gets an element from the
JsonArray, at the
specified JsonPath. |
Object |
getElementAtJsonPath(JsonArray array,
String jsonPath,
Object defaultElement)
Gets an element from the
JsonArray, at the
specified JsonPath. |
Object |
getElementAtJsonPath(JsonObject obj,
String jsonPath)
Gets an element from the
JsonObject,
at the specified JsonPath. |
Object |
getElementAtJsonPath(JsonObject obj,
String jsonPath,
Object defaultElement)
Gets an element from the
JsonObject,
at the specified JsonPath. |
protected JsonManager |
getJsonManager() |
protected int |
getJsonPathArrayIndexMax() |
protected int |
getKeyMaxLengthWhenConvertingMapToJsonObject() |
protected SpincastConfig |
getSpincastConfig() |
boolean |
isElementExists(JsonArray array,
String jsonPath)
Does the array contain an element at
the
JsonPath position (even if
null)? |
boolean |
isElementExists(JsonObject root,
String jsonPath)
Does the object contain an element at
the
JsonPath position (even if
null)? |
protected Object |
processJsonPath(JsonObject root,
String jsonPath,
JsonPathPathUtilsDefault.JsonPathProcessingType jsonPathProcessingType,
Object valueToPut,
boolean hasDefaultValue,
Object defaultElement) |
void |
putElementAtJsonPath(JsonObjectOrArray root,
String jsonPath,
Object valueToAdd)
Puts an element in the object at the specified
JsonPath
position. |
void |
removeElementAtJsonPath(JsonArray array,
String jsonPath)
Removes an element at the specified
JsonPath from the
array. |
void |
removeElementAtJsonPath(JsonObject root,
String jsonPath)
Removes an element at the specified
JsonPath from the
object. |
protected Object |
selectValueUsingJsonPath(JsonArray array,
String jsonPath,
boolean hasDefaultValue,
Object defaultElement) |
protected Object |
selectValueUsingJsonPath(JsonObject obj,
String jsonPath,
boolean hasDefaultValue,
Object defaultElement) |
@Inject public JsonPathPathUtilsDefault(SpincastConfig spincastConfig, JsonManager jsonManager)
protected SpincastConfig getSpincastConfig()
protected JsonManager getJsonManager()
protected int getJsonPathArrayIndexMax()
protected int getKeyMaxLengthWhenConvertingMapToJsonObject()
public Object getElementAtJsonPath(JsonObject obj, String jsonPath)
JsonPathUtilsJsonObject,
at the specified JsonPath.getElementAtJsonPath in interface JsonPathUtilsnull if not found.public Object getElementAtJsonPath(JsonObject obj, String jsonPath, Object defaultElement)
JsonPathUtilsJsonObject,
at the specified JsonPath.getElementAtJsonPath in interface JsonPathUtilsdefault element if not found.protected Object selectValueUsingJsonPath(JsonObject obj, String jsonPath, boolean hasDefaultValue, Object defaultElement)
public Object getElementAtJsonPath(JsonArray array, String jsonPath)
JsonPathUtilsJsonArray, at the
specified JsonPath.getElementAtJsonPath in interface JsonPathUtilsnull if not found.public Object getElementAtJsonPath(JsonArray array, String jsonPath, Object defaultElement)
JsonPathUtilsJsonArray, at the
specified JsonPath.getElementAtJsonPath in interface JsonPathUtilsdefault element if not found.protected Object selectValueUsingJsonPath(JsonArray array, String jsonPath, boolean hasDefaultValue, Object defaultElement)
public void putElementAtJsonPath(JsonObjectOrArray root, String jsonPath, Object valueToAdd)
JsonPathUtilsJsonPath
position. No clone is made, the element is put as is.
The complete hierarchy to the final element is created if required.
putElementAtJsonPath in interface JsonPathUtilspublic void removeElementAtJsonPath(JsonObject root, String jsonPath)
JsonPathUtilsJsonPath from the
object.removeElementAtJsonPath in interface JsonPathUtilspublic void removeElementAtJsonPath(JsonArray array, String jsonPath)
JsonPathUtilsJsonPath from the
array.removeElementAtJsonPath in interface JsonPathUtilspublic boolean isElementExists(JsonObject root, String jsonPath)
JsonPathUtilsJsonPath position (even if
null)?isElementExists in interface JsonPathUtilspublic boolean isElementExists(JsonArray array, String jsonPath)
JsonPathUtilsJsonPath position (even if
null)?isElementExists in interface JsonPathUtilsprotected Object processJsonPath(JsonObject root, String jsonPath, JsonPathPathUtilsDefault.JsonPathProcessingType jsonPathProcessingType, Object valueToPut, boolean hasDefaultValue, Object defaultElement)
Copyright © 2016. All rights reserved.