Class JsonObjectAccessorImpl
- java.lang.Object
-
- org.hibernate.search.backend.elasticsearch.gson.impl.JsonObjectAccessorImpl
-
- All Implemented Interfaces:
JsonAccessor<com.google.gson.JsonObject>,JsonObjectAccessor
public class JsonObjectAccessorImpl extends Object implements JsonObjectAccessor
AJsonAccessorthat ensures the accessed object is aJsonObject.
-
-
Constructor Summary
Constructors Constructor Description JsonObjectAccessorImpl(JsonAccessor<com.google.gson.JsonElement> parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendRuntimeRelativePath(StringBuilder path)protected voidappendStaticRelativePath(StringBuilder path, boolean first)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.JsonObject>getExpectedElementType()com.google.gson.JsonObjectgetOrCreate(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()UnknownTypeJsonAccessorproperty(String propertyName)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
-
JsonObjectAccessorImpl
public JsonObjectAccessorImpl(JsonAccessor<com.google.gson.JsonElement> parent)
-
-
Method Detail
-
getExpectedElementType
protected JsonElementType<com.google.gson.JsonObject> getExpectedElementType()
-
getOrCreate
public com.google.gson.JsonObject getOrCreate(com.google.gson.JsonObject root)
-
property
public UnknownTypeJsonAccessor property(String propertyName)
- Specified by:
propertyin interfaceJsonObjectAccessor
-
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()
-
-