Class JsonIntegerAccessor
- java.lang.Object
-
- org.hibernate.search.backend.elasticsearch.gson.impl.JsonIntegerAccessor
-
- All Implemented Interfaces:
JsonAccessor<Integer>
public class JsonIntegerAccessor extends Object
-
-
Constructor Summary
Constructors Constructor Description JsonIntegerAccessor(JsonAccessor<com.google.gson.JsonElement> parentAccessor)
-
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<Integer>getExpectedElementType()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()
-
-
-
Constructor Detail
-
JsonIntegerAccessor
public JsonIntegerAccessor(JsonAccessor<com.google.gson.JsonElement> parentAccessor)
-
-
Method Detail
-
getExpectedElementType
protected JsonElementType<Integer> getExpectedElementType()
-
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()
-
-