Class JsonArrayAccessorImpl
- java.lang.Object
-
- org.hibernate.search.backend.elasticsearch.gson.impl.JsonArrayAccessorImpl
-
- All Implemented Interfaces:
JsonAccessor<com.google.gson.JsonArray>,JsonArrayAccessor
public class JsonArrayAccessorImpl extends Object implements JsonArrayAccessor
-
-
Constructor Summary
Constructors Constructor Description JsonArrayAccessorImpl(JsonAccessor<com.google.gson.JsonElement> parentAccessor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddElementIfAbsent(com.google.gson.JsonObject root, com.google.gson.JsonElement newValue)Add the given JsonElement to the array this accessor points to for the givenroot, unless it is already present.protected voidappendRuntimeRelativePath(StringBuilder path)protected voidappendStaticRelativePath(StringBuilder path, boolean first)UnknownTypeJsonAccessorelement(int index)Optional<T>get(com.google.gson.JsonObject root)Get the current value of the element this accessor points to for the givenroot.protected JsonElementType<com.google.gson.JsonArray>getExpectedElementType()com.google.gson.JsonArraygetOrCreate(com.google.gson.JsonObject root)TgetOrCreate(com.google.gson.JsonObject root, Supplier<? extends T> newValueSupplier)Get the current value of the element this accessor points to for the givenroot, creating it and setting it if it hasn't been set yet.protected JsonAccessor<P>getParentAccessor()voidset(com.google.gson.JsonObject root, T newValue)Set the given value on the element this accessor points to for the givenroot.protected com.google.gson.JsonElementtoElement(T value)StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hibernate.search.backend.elasticsearch.gson.impl.JsonAccessor
get, getOrCreate, set
-
-
-
-
Constructor Detail
-
JsonArrayAccessorImpl
public JsonArrayAccessorImpl(JsonAccessor<com.google.gson.JsonElement> parentAccessor)
-
-
Method Detail
-
getExpectedElementType
protected JsonElementType<com.google.gson.JsonArray> getExpectedElementType()
-
getOrCreate
public com.google.gson.JsonArray getOrCreate(com.google.gson.JsonObject root)
-
element
public UnknownTypeJsonAccessor element(int index)
- Specified by:
elementin interfaceJsonArrayAccessor
-
addElementIfAbsent
public void addElementIfAbsent(com.google.gson.JsonObject root, com.google.gson.JsonElement newValue)Description copied from interface:JsonArrayAccessorAdd the given JsonElement to the array this accessor points to for the givenroot, unless it is already present.- Specified by:
addElementIfAbsentin interfaceJsonArrayAccessor- Parameters:
root- The root to be accessed.newValue- The value to add.
-
get
public Optional<T> get(com.google.gson.JsonObject root)
Description copied from interface:JsonAccessorGet the current value of the element this accessor points to for the givenroot.- Parameters:
root- The root to be accessed.- Returns:
- An
Optionalcontaining the current value pointed to by this accessor on theroot, orOptional.empty()if it doesn't exist.
-
set
public void set(com.google.gson.JsonObject root, T newValue)Description copied from interface:JsonAccessorSet the given value on the element this accessor points to for the givenroot.- Parameters:
root- The root to be accessed.newValue- The value to set.
-
getOrCreate
public T getOrCreate(com.google.gson.JsonObject root, Supplier<? extends T> newValueSupplier)Description copied from interface:JsonAccessorGet the current value of the element this accessor points to for the givenroot, creating it and setting it if it hasn't been set yet.- Parameters:
root- The root to be accessed.newValueSupplier- The value to set and return if the current value hasn't been set yet.- Returns:
- The current value pointed to by this accessor on the
root, always non-null.
-
toElement
protected com.google.gson.JsonElement toElement(T value)
-
appendRuntimeRelativePath
protected void appendRuntimeRelativePath(StringBuilder path)
-
appendStaticRelativePath
protected void appendStaticRelativePath(StringBuilder path, boolean first)
-
getParentAccessor
protected JsonAccessor<P> getParentAccessor()
-
-