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 Details

    • JsonArrayAccessorImpl

      public JsonArrayAccessorImpl(JsonAccessor<com.google.gson.JsonElement> parentAccessor)
  • Method Details

    • 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:
      element in interface JsonArrayAccessor
    • addElementIfAbsent

      public void addElementIfAbsent(com.google.gson.JsonObject root, com.google.gson.JsonElement newValue)
      Description copied from interface: JsonArrayAccessor
      Add the given JsonElement to the array this accessor points to for the given root, unless it is already present.
      Specified by:
      addElementIfAbsent in interface JsonArrayAccessor
      Parameters:
      root - The root to be accessed.
      newValue - The value to add.
    • get

      public Optional<com.google.gson.JsonArray> get(com.google.gson.JsonObject root)
      Description copied from interface: JsonAccessor
      Get the current value of the element this accessor points to for the given root.
      Parameters:
      root - The root to be accessed.
      Returns:
      An Optional containing the current value pointed to by this accessor on the root, or Optional.empty() if it doesn't exist.
    • set

      public void set(com.google.gson.JsonObject root, com.google.gson.JsonArray newValue)
      Description copied from interface: JsonAccessor
      Set the given value on the element this accessor points to for the given root.
      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: JsonAccessor
      Get the current value of the element this accessor points to for the given root, 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

      protected void appendRuntimeRelativePath(StringBuilder path)
    • appendStaticRelativePath

      protected void appendStaticRelativePath(StringBuilder path, boolean first)
    • getParentAccessor

      protected JsonAccessor<com.google.gson.JsonElement> getParentAccessor()
    • toString

      public String toString()
      Overrides:
      toString in class Object