Package org.spincast.core.json
Class JsonPathUtilsDefault
java.lang.Object
org.spincast.core.json.JsonPathUtilsDefault
- All Implemented Interfaces:
JsonPathUtils
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enum -
Constructor Summary
ConstructorsConstructorDescriptionJsonPathUtilsDefault(SpincastConfig spincastConfig, JsonManager jsonManager) Constructor -
Method Summary
Modifier and TypeMethodDescriptiongetElementAtJsonPath(JsonArray array, String jsonPath) Gets an element from theJsonArray, at the specifiedJsonPath.getElementAtJsonPath(JsonArray array, String jsonPath, Object defaultElement) Gets an element from theJsonArray, at the specifiedJsonPath.getElementAtJsonPath(JsonObject obj, String jsonPath) Gets an element from theJsonObject, at the specifiedJsonPath.getElementAtJsonPath(JsonObject obj, String jsonPath, Object defaultElement) Gets an element from theJsonObject, at the specifiedJsonPath.protected JsonManagerprotected intprotected intprotected SpincastConfigbooleanisElementExists(JsonArray array, String jsonPath) Does the array contain an element at theJsonPathposition (even ifnull)?booleanisElementExists(JsonObject root, String jsonPath) Does the object contain an element at theJsonPathposition (even ifnull)?protected ObjectprocessJsonPath(JsonObject root, String jsonPath, JsonPathUtilsDefault.JsonPathProcessingType jsonPathProcessingType, Object valueToPut, boolean hasDefaultValue, Object defaultElement) voidputElementAtJsonPath(JsonObjectOrArray root, String jsonPath, Object valueToAdd) Puts an element in the object at the specifiedJsonPathposition.voidremoveElementAtJsonPath(JsonArray array, String jsonPath) Removes an element at the specifiedJsonPathfrom the array.voidremoveElementAtJsonPath(JsonObject root, String jsonPath) Removes an element at the specifiedJsonPathfrom the object.protected ObjectselectValueUsingJsonPath(JsonArray array, String jsonPath, boolean hasDefaultValue, Object defaultElement) protected ObjectselectValueUsingJsonPath(JsonObject obj, String jsonPath, boolean hasDefaultValue, Object defaultElement)
-
Constructor Details
-
JsonPathUtilsDefault
Constructor
-
-
Method Details
-
getSpincastConfig
-
getJsonManager
-
getJsonPathArrayIndexMax
protected int getJsonPathArrayIndexMax() -
getKeyMaxLengthWhenConvertingMapToJsonObject
protected int getKeyMaxLengthWhenConvertingMapToJsonObject() -
getElementAtJsonPath
Description copied from interface:JsonPathUtilsGets an element from theJsonObject, at the specifiedJsonPath.- Specified by:
getElementAtJsonPathin interfaceJsonPathUtils- Returns:
- the element or
nullif not found.
-
getElementAtJsonPath
Description copied from interface:JsonPathUtilsGets an element from theJsonObject, at the specifiedJsonPath.- Specified by:
getElementAtJsonPathin interfaceJsonPathUtils- Returns:
- the element or the
default elementif not found.
-
selectValueUsingJsonPath
protected Object selectValueUsingJsonPath(JsonObject obj, String jsonPath, boolean hasDefaultValue, Object defaultElement) -
getElementAtJsonPath
Description copied from interface:JsonPathUtilsGets an element from theJsonArray, at the specifiedJsonPath.- Specified by:
getElementAtJsonPathin interfaceJsonPathUtils- Returns:
- the element or
nullif not found.
-
getElementAtJsonPath
Description copied from interface:JsonPathUtilsGets an element from theJsonArray, at the specifiedJsonPath.- Specified by:
getElementAtJsonPathin interfaceJsonPathUtils- Returns:
- the element or the
default elementif not found.
-
selectValueUsingJsonPath
-
putElementAtJsonPath
Description copied from interface:JsonPathUtilsPuts an element in the object at the specifiedJsonPathposition. No clone is made, the element is put as is.The complete hierarchy to the final element is created if required.
- Specified by:
putElementAtJsonPathin interfaceJsonPathUtils
-
removeElementAtJsonPath
Description copied from interface:JsonPathUtilsRemoves an element at the specifiedJsonPathfrom the object.- Specified by:
removeElementAtJsonPathin interfaceJsonPathUtils
-
removeElementAtJsonPath
Description copied from interface:JsonPathUtilsRemoves an element at the specifiedJsonPathfrom the array.- Specified by:
removeElementAtJsonPathin interfaceJsonPathUtils
-
isElementExists
Description copied from interface:JsonPathUtilsDoes the object contain an element at theJsonPathposition (even ifnull)?- Specified by:
isElementExistsin interfaceJsonPathUtils
-
isElementExists
Description copied from interface:JsonPathUtilsDoes the array contain an element at theJsonPathposition (even ifnull)?- Specified by:
isElementExistsin interfaceJsonPathUtils
-
processJsonPath
protected Object processJsonPath(JsonObject root, String jsonPath, JsonPathUtilsDefault.JsonPathProcessingType jsonPathProcessingType, Object valueToPut, boolean hasDefaultValue, Object defaultElement)
-