public.javadoc.org.spincast.core.json.JsonPathUtils.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
JsonPathUtils (org.spincast:spincast-framework 1.0.0 API)
org.spincast.core.json
Interface JsonPathUtils
-
- All Known Implementing Classes:
- JsonPathUtilsDefault
public interface JsonPathUtils
Utilities to deal with JsonPaths
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods
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
.
boolean
isElementExists(JsonArray array,
String jsonPath)
Does the array contain an element at
the JsonPath
position (even if
null
)?
boolean
isElementExists(JsonObject obj,
String jsonPath)
Does the object contain an element at
the JsonPath
position (even if
null
)?
void
putElementAtJsonPath(JsonObjectOrArray root,
String jsonPath,
Object elementToAdd)
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 obj,
String jsonPath)
Removes an element at the specified JsonPath
from the
object.
-
-
Method Detail
-
getElementAtJsonPath
Object getElementAtJsonPath(JsonObject obj,
String jsonPath)
Gets an element from the JsonObject
,
at the specified JsonPath
.
- Returns:
- the element or
null
if not found.
-
getElementAtJsonPath
Object getElementAtJsonPath(JsonObject obj,
String jsonPath,
Object defaultElement)
Gets an element from the JsonObject
,
at the specified JsonPath
.
- Returns:
- the element or the
default element
if not found.
-
getElementAtJsonPath
Object getElementAtJsonPath(JsonArray array,
String jsonPath)
Gets an element from the JsonArray
, at the
specified JsonPath
.
- Returns:
- the element or
null
if not found.
-
getElementAtJsonPath
Object getElementAtJsonPath(JsonArray array,
String jsonPath,
Object defaultElement)
Gets an element from the JsonArray
, at the
specified JsonPath
.
- Returns:
- the element or the
default element
if not found.
-
putElementAtJsonPath
void putElementAtJsonPath(JsonObjectOrArray root,
String jsonPath,
Object elementToAdd)
Puts an element in the object at the specified JsonPath
position. No clone is made, the element is put as is.
The complete hierarchy to the final element is created if required.
-
removeElementAtJsonPath
void removeElementAtJsonPath(JsonObject obj,
String jsonPath)
Removes an element at the specified JsonPath
from the
object.
-
removeElementAtJsonPath
void removeElementAtJsonPath(JsonArray array,
String jsonPath)
Removes an element at the specified JsonPath
from the
array.
-
isElementExists
boolean isElementExists(JsonObject obj,
String jsonPath)
Does the object contain an element at
the JsonPath
position (even if
null
)?
Copyright © 2019. All rights reserved.