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 methodsadd()
,replace()
, andremove()
executes the operations specified in RFC 6902.- Since:
- 1.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends JsonStructure>
Tadd(T target, JsonValue newValue)
Add 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.JsonValue
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(T target, JsonValue newValue)
Replace the value at the position referenced by this JsonPointer with the newValue.
-
-
-
Method Detail
-
getValue
JsonValue getValue(JsonStructure target)
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 locationjava.lang.NullPointerException
- if the target isnull
-
add
<T extends JsonStructure> T add(T target, JsonValue newValue)
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 locationjava.lang.NullPointerException
- if the target isnull
-
remove
<T extends JsonStructure> T remove(T target)
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 locationjava.lang.NullPointerException
- if the target isnull
-
replace
<T extends JsonStructure> T replace(T target, JsonValue newValue)
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 locationjava.lang.NullPointerException
- if the target isnull
-
containsValue
boolean containsValue(JsonStructure target)
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:
java.lang.NullPointerException
- if the target isnull
-
-