Class NodeReference.ArrayReference
java.lang.Object
org.eclipse.parsson.NodeReference
org.eclipse.parsson.NodeReference.ArrayReference
- Enclosing class:
NodeReference
-
Nested Class Summary
Nested classes/interfaces inherited from class NodeReference
NodeReference.ArrayReference, NodeReference.ObjectReference, NodeReference.RootReference -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final jakarta.json.JsonArrayprivate final intprivate final JsonContext -
Constructor Summary
ConstructorsConstructorDescriptionArrayReference(jakarta.json.JsonArray array, int index, JsonContext jsonContext) -
Method Summary
Modifier and TypeMethodDescriptionjakarta.json.JsonArrayadd(jakarta.json.JsonValue value) Add or replace a value at the referenced location.booleancontains()Returntrueif a reference points to a valid value,falseotherwise.jakarta.json.JsonValueget()Get the value at the referenced location.jakarta.json.JsonArrayremove()Remove the name/value pair from the JSON object, or the value in a JSON array, as specified by the referencejakarta.json.JsonArrayreplace(jakarta.json.JsonValue value) Replace the referenced value with the specified value.Methods inherited from class NodeReference
of, of, of
-
Field Details
-
array
private final jakarta.json.JsonArray array -
index
private final int index -
jsonContext
-
-
Constructor Details
-
ArrayReference
ArrayReference(jakarta.json.JsonArray array, int index, JsonContext jsonContext)
-
-
Method Details
-
contains
public boolean contains()Description copied from class:NodeReferenceReturntrueif a reference points to a valid value,falseotherwise.- Specified by:
containsin classNodeReference- Returns:
trueif a reference points to a value
-
get
public jakarta.json.JsonValue get()Description copied from class:NodeReferenceGet the value at the referenced location.- Specified by:
getin classNodeReference- Returns:
- the JSON value referenced
-
add
public jakarta.json.JsonArray add(jakarta.json.JsonValue value) Description copied from class:NodeReferenceAdd or replace a value at the referenced location. If the reference is the root of a JSON tree, the added value must be a JSON object or array, which becomes the referenced JSON value. If the reference is an index of a JSON array, the value is inserted into the array at the index. If the index is -1, the value is appended to the array. If the reference is a name of a JSON object, the name/value pair is added to the object, replacing any pair with the same name.- Specified by:
addin classNodeReference- Parameters:
value- the value to be added- Returns:
- the JsonStructure after the operation
-
remove
public jakarta.json.JsonArray remove()Description copied from class:NodeReferenceRemove the name/value pair from the JSON object, or the value in a JSON array, as specified by the reference- Specified by:
removein classNodeReference- Returns:
- the JsonStructure after the operation
-
replace
public jakarta.json.JsonArray replace(jakarta.json.JsonValue value) Description copied from class:NodeReferenceReplace the referenced value with the specified value.- Specified by:
replacein classNodeReference- Parameters:
value- the JSON value to be stored at the referenced location- Returns:
- the JsonStructure after the operation
-