Class JsonArrayAccessorImpl
java.lang.Object
org.hibernate.search.backend.elasticsearch.gson.impl.JsonArrayAccessorImpl
- All Implemented Interfaces:
JsonAccessor<com.google.gson.JsonArray>,JsonArrayAccessor
-
Constructor Summary
ConstructorsConstructorDescriptionJsonArrayAccessorImpl(JsonAccessor<com.google.gson.JsonElement> parentAccessor) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddElementIfAbsent(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 voidprotected voidappendStaticRelativePath(StringBuilder path, boolean first) element(int index) Optional<com.google.gson.JsonArray>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>com.google.gson.JsonArraygetOrCreate(com.google.gson.JsonObject root) com.google.gson.JsonArraygetOrCreate(com.google.gson.JsonObject root, Supplier<? extends com.google.gson.JsonArray> 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<com.google.gson.JsonElement>voidset(com.google.gson.JsonObject root, com.google.gson.JsonArray newValue) Set the given value on the element this accessor points to for the givenroot.protected com.google.gson.JsonElementtoElement(com.google.gson.JsonArray value) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.hibernate.search.backend.elasticsearch.gson.impl.JsonAccessor
get, getOrCreate, set
-
Constructor Details
-
JsonArrayAccessorImpl
-
-
Method Details
-
getExpectedElementType
-
getOrCreate
public com.google.gson.JsonArray getOrCreate(com.google.gson.JsonObject root) -
element
- 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
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, com.google.gson.JsonArray 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 com.google.gson.JsonArray getOrCreate(com.google.gson.JsonObject root, Supplier<? extends com.google.gson.JsonArray> 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(com.google.gson.JsonArray value) -
appendRuntimeRelativePath
-
appendStaticRelativePath
-
getParentAccessor
-
toString
-