public abstract class JsonAccessor extends Object
| Constructor and Description |
|---|
JsonAccessor() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
add(com.google.gson.JsonObject root,
com.google.gson.JsonPrimitive newValue)
Add the given primitive value to the element this accessor points to for the
given
root. |
JsonAccessor |
element(int index) |
abstract com.google.gson.JsonElement |
get(com.google.gson.JsonObject root)
Get the current value of the element this accessor points to for the given
root. |
abstract <T extends com.google.gson.JsonElement> |
getOrCreate(com.google.gson.JsonObject root,
JsonElementType<T> type)
Get the current value of the lement this accessor points to for the given
root,
creating it and setting it if it hasn't been set yet. |
abstract String |
getStaticAbsolutePath() |
JsonAccessor |
property(String propertyName) |
static JsonAccessor |
root() |
abstract void |
set(com.google.gson.JsonObject root,
com.google.gson.JsonElement newValue)
Set the given value on the element this accessor points to for the given
root. |
public abstract com.google.gson.JsonElement get(com.google.gson.JsonObject root)
root.root - The root to be accessed.root,
or null if it doesn't exist.public abstract void set(com.google.gson.JsonObject root,
com.google.gson.JsonElement newValue)
throws UnexpectedJsonElementTypeException
root.root - The root to be accessed.newValue - The value to set.UnexpectedJsonElementTypeException - If an element in the path has unexpected type, preventing
access to the element this accessor points to.public abstract void add(com.google.gson.JsonObject root,
com.google.gson.JsonPrimitive newValue)
throws UnexpectedJsonElementTypeException
root.
This method differs from set(JsonObject, JsonElement):
set.
JsonNull, the current value
is replaced by an array containing the current value followed by the given value.
UnexpectedJsonElementTypeException is thrown.
root - The root to be accessed.newValue - The value to add.UnexpectedJsonElementTypeException - If an element in the path has unexpected type, preventing
write access to the element this accessor points to.public abstract <T extends com.google.gson.JsonElement> T getOrCreate(com.google.gson.JsonObject root,
JsonElementType<T> type)
throws UnexpectedJsonElementTypeException
root,
creating it and setting it if it hasn't been set yet.root - The root to be accessed.type - The expected JsonElementType.root, always non-null
and typed according to type.UnexpectedJsonElementTypeException - if the element already exists and is not of type type, or
if an element in the path has unexpected type, preventing access to the element this accessor
points to.public abstract String getStaticAbsolutePath()
null for the root accessor.public static JsonAccessor root()
public JsonAccessor property(String propertyName)
public JsonAccessor element(int index)
Copyright © 2006–2017 Hibernate. All rights reserved.