public interface JsonProvider
| Modifier and Type | Method and Description |
|---|---|
void |
add(Object jsonArray,
Object element)
Appends the specified element to the end of the specified JSON array.
|
boolean |
arrayContains(Object jsonArray,
Object element)
Checks if the specified JSON array contains the specified element.
|
Set<Map.Entry<String,Object>> |
entrySet(Object jsonObject)
Returns a
Set view of the mappings contained in the specified JSON object. |
void |
forEachElementInArray(Object jsonArray,
Consumer<? super Object> action)
Performs the given action for each element of the specified JSON array until all
entries have been processed.
|
Object |
get(Object jsonObject,
String key)
Returns the value to which the specified key is mapped in the specified JSON object; or
null if the JSON does not contain the specified key. |
boolean |
isEmpty(Object jsonObject)
Checks if the specified JSON object contains no data.
|
boolean |
isJsonArray(Object object)
Checks if the specified object is a JSON array for this provider.
|
boolean |
isJsonObject(Object object)
Checks if the specified object is a JSON object for this provider.
|
Object |
newJsonArray()
Creates a provider-specific JSON array.
|
Object |
newJsonArray(Object sourceJsonArray)
Creates a new provider-specific JSON array with the elements of a preset JSON array.
|
Object |
newJsonObject()
Creates a provider-specific JSON object.
|
Object |
newJsonObject(Object sourceJsonObject)
Creates a new provider-specific JSON object with the contents of a preset JSON object.
|
void |
put(Object jsonObject,
String key,
Object value)
Associates the specified value with the specified key in the specified JSON object.
|
void |
putIfAbsent(Object jsonObject,
String key,
Object value)
Associates the specified value with the specified key in the specified JSON object,
provided that the specified key is not already associated with a value in the JSON.
|
Stream<Object> |
stream(Object jsonArray)
Returns a sequential
Stream with the specified JSON array as its source. |
boolean isJsonObject(Object object)
object - the object to be checkedtrue if the specified object is a provider-specific JSON object;
otherwise, false.boolean isJsonArray(Object object)
object - the object to be checkedtrue if the specified object is a provider-specific JSON array;
otherwise, false.boolean isEmpty(Object jsonObject)
jsonObject - the JSON object to be checked; not nulltrue if the specified JSON object contains no data; otherwise,
false.ClassCastException - if the specified parameter is not a valid JSON object for
this providerObject newJsonObject()
Object newJsonObject(Object sourceJsonObject)
Note: The resulting object is supposed to be shallow copy of the source JSON object.
sourceJsonObject - the JSON whose contents are to be copied; not nullObject newJsonArray()
Object newJsonArray(Object sourceJsonArray)
Note: Although the actual implementation may vary depending on the concrete provider, the resulting object is supposed to be shallow copy of the source JSON array.
sourceJsonArray - the JSON array whose contents are to be copied; not nullSet<Map.Entry<String,Object>> entrySet(Object jsonObject)
Set view of the mappings contained in the specified JSON object.jsonObject - the JSON object whose entries shall be accessed; not nullClassCastException - if the specified parameter is not a valid JSON object for
this providerObject get(Object jsonObject, String key)
null if the JSON does not contain the specified key.jsonObject - the JSON object; not nullkey - the key to be searched; not nullClassCastException - if the specified jsonObject is not a valid JSON
object for this providervoid put(Object jsonObject, String key, Object value)
jsonObject - the JSON object; not nullkey - the key with which the specified value is to be associated in the
JSON; not nullvalue - the value to be associated with the specified key in the JSONClassCastException - if the specified jsonObject is not a valid JSON
object for this providervoid putIfAbsent(Object jsonObject, String key, Object value)
jsonObject - the JSON object; not nullkey - the key with which the specified value is to be associated in the
JSON; not nullvalue - the value to be associated with the specified key in the JSON,
provided that the specified key is absent in the documentClassCastException - if the specified jsonObject is not a valid JSON
object for this providervoid add(Object jsonArray, Object element)
jsonArray - the JSON array; not nullelement - the element to be addedClassCastException - if the specified jsonArray is not a valid JSON array
for this providervoid forEachElementInArray(Object jsonArray, Consumer<? super Object> action)
jsonArray - the JSON array; not nullaction - the action to be performed for each element; not nullClassCastException - if the specified jsonArray is not a valid JSON
array for this providerNullPointerException - if the specified action is nullboolean arrayContains(Object jsonArray, Object element)
jsonArray - the JSON array; not nullelement - the element to be searchedtrue if the specified JSON array contains the specified element;
otherwise, false.ClassCastException - if the specified jsonArray is not a valid JSON array
for this providerStream<Object> stream(Object jsonArray)
Stream with the specified JSON array as its source.jsonArray - the JSON array; not nullStream over the elements in this JSON arrayClassCastException - if the specified jsonArray is not a valid JSON array
for this providerCopyright © 2022. All rights reserved.