Package io.vertx.core.json.pointer
Interface JsonPointerIterator
-
public interface JsonPointerIterator
The JsonPointerIterator is used by the read/write algorithms of theJsonPointer
to read/write the querying data structure
Every method takes the currentValue as parameter, representing the actual value held by the query algorithm.
Implementations of this interface should be stateless, so they can be reused
You can implement this interface to query the structure you want using json pointers- Author:
- Francesco Guardiani @slinkydeveloper
-
-
Field Summary
Fields Modifier and Type Field Description static JsonPointerIterator
JSON_ITERATOR
Instance of a JsonPointerIterator to query Vert.x Json structures
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
appendArrayElement(Object currentValue, Object value)
Append array elementObject
getArrayElement(Object currentValue, int i)
Move the iterator the array element at specified indexObject
getObjectParameter(Object currentValue, String key, boolean createOnMissing)
Returns the object parameter with specified key.boolean
isArray(Object currentValue)
boolean
isNull(Object currentValue)
boolean
isObject(Object currentValue)
boolean
objectContainsKey(Object currentValue, String key)
boolean
writeArrayElement(Object currentValue, int i, Object value)
Write array element at specified indexboolean
writeObjectParameter(Object currentValue, String key, Object value)
Write object parameter at specified key
-
-
-
Field Detail
-
JSON_ITERATOR
static final JsonPointerIterator JSON_ITERATOR
Instance of a JsonPointerIterator to query Vert.x Json structures
-
-
Method Detail
-
isObject
boolean isObject(Object currentValue)
- Parameters:
currentValue
-- Returns:
true
if the current value is a queryable object
-
isArray
boolean isArray(Object currentValue)
- Parameters:
currentValue
-- Returns:
true
if the current value is a queryable array
-
isNull
boolean isNull(Object currentValue)
- Parameters:
currentValue
-- Returns:
true
if the current value is null/empty
-
objectContainsKey
boolean objectContainsKey(Object currentValue, String key)
- Parameters:
currentValue
-key
- object key- Returns:
true
if current value is a queryable object that contains the specified key
-
getObjectParameter
Object getObjectParameter(Object currentValue, String key, boolean createOnMissing)
Returns the object parameter with specified key.- Parameters:
currentValue
-key
- object keycreateOnMissing
- If the current value is an object that doesn't contain the key, put an empty object at provided key- Returns:
- the requested object parameter, or null if the method was not able to find it
-
getArrayElement
Object getArrayElement(Object currentValue, int i)
Move the iterator the array element at specified index- Parameters:
currentValue
-i
- array index- Returns:
- the request array element, or null if the method was not able to find it
-
writeObjectParameter
boolean writeObjectParameter(Object currentValue, String key, Object value)
Write object parameter at specified key- Parameters:
currentValue
-key
-value
-- Returns:
- true if the operation is successful
-
writeArrayElement
boolean writeArrayElement(Object currentValue, int i, Object value)
Write array element at specified index- Parameters:
currentValue
-i
-value
-- Returns:
- true if the operation is successful
-
-