Package javax.json
Interface JsonPointer
public interface JsonPointer
This class is an immutable representation of a JSON Pointer as specified in RFC 6901.
JSON Pointer is a string syntax for identifying a specific value within a JavaScript Object Notation (JSON) document [RFC4627]. JSON Pointer is intended to be easily expressed in JSON string values as well as Uniform Resource Identifier (URI) [RFC3986] fragment identifiers.
The method getValue()
returns the referenced value.
The methods add()
, replace()
,
and remove()
executes the operations specified in
RFC 6902.
- Since:
- 1.1
-
Method Summary
Modifier and TypeMethodDescription<T extends JsonStructure>
TAdd or replace the value at the position referenced by this JsonPointer with the new valueboolean
containsValue
(JsonStructure target) Verify if the target JSON structure contains a value at the referenced location.getValue
(JsonStructure target) Get the JsonValue at the position referenced by this JsonPointer.<T extends JsonStructure>
Tremove
(T target) Remove the value from the referenced position inside the target JSON.<T extends JsonStructure>
TReplace the value at the position referenced by this JsonPointer with the newValue.
-
Method Details
-
getValue
Get the JsonValue at the position referenced by this JsonPointer.- Parameters:
target
- the JSON to apply this JsonPointer on- Returns:
- the
- Throws:
JsonException
- if no value exists at the referenced locationNullPointerException
- if the target isnull
-
add
Add or replace the value at the position referenced by this JsonPointer with the new value- Type Parameters:
T
-- Parameters:
target
- structure in which the newValue should be added or replacednewValue
- the new value to set- Returns:
- the new structure after modifying the original JsonStrucure
- Throws:
JsonException
- if no value exists at the referenced locationNullPointerException
- if the target isnull
-
remove
Remove the value from the referenced position inside the target JSON.- Type Parameters:
T
- the type of the passed JsonStructure- Parameters:
target
- to remove the value from- Returns:
- a new JsonStructure with the value removed from the target
- Throws:
JsonException
- if no value exists at the referenced locationNullPointerException
- if the target isnull
-
replace
Replace the value at the position referenced by this JsonPointer with the newValue.- Type Parameters:
T
-- Parameters:
target
- structure in which the newValue should be replacednewValue
- the new value to set- Returns:
- the new structure after modifying the original JsonStrucure
- Throws:
JsonException
- if no value exists at the referenced locationNullPointerException
- if the target isnull
-
containsValue
Verify if the target JSON structure contains a value at the referenced location.- Parameters:
target
- to check- Returns:
true
if there is a value at the referenced location,false
otherwise- Throws:
NullPointerException
- if the target isnull
-