Record Class GsonRootObjectVisitor

java.lang.Object
java.lang.Record
eu.cloudnetservice.driver.document.gson.send.GsonRootObjectVisitor
Record Components:
rootObject - the root json object to put all child elements into.
All Implemented Interfaces:
ElementVisitor

public record GsonRootObjectVisitor(@NonNull com.google.gson.JsonObject rootObject) extends Record implements ElementVisitor
An element visitor to visit the root object element of a document send. This visitor only accepts calls to visitObject(ObjectElement), all other calls with throw an UnsupportedOperationException.
Since:
4.0
  • Field Details

    • rootObject

      @NonNull private final @NonNull com.google.gson.JsonObject rootObject
      The field for the rootObject record component.
  • Constructor Details

    • GsonRootObjectVisitor

      public GsonRootObjectVisitor(@NonNull @NonNull com.google.gson.JsonObject rootObject)
      Creates an instance of a GsonRootObjectVisitor record class.
      Parameters:
      rootObject - the value for the rootObject record component
  • Method Details

    • visitEnd

      public void visitEnd()
      Called when the end of visit for this visitor is reached. That can for example be when all elements of an array element were processed.
      Specified by:
      visitEnd in interface ElementVisitor
    • visitNull

      public void visitNull(@NonNull @NonNull NullElement entry)
      Visits a null element.
      Specified by:
      visitNull in interface ElementVisitor
      Parameters:
      entry - the null element to visit.
    • visitPrimitive

      public void visitPrimitive(@NonNull @NonNull PrimitiveElement entry)
      Visits a primitive element.
      Specified by:
      visitPrimitive in interface ElementVisitor
      Parameters:
      entry - the primitive element to visit.
    • visitArray

      Starts the visit of an array element. The returned element visitor is used to visit each entry of the array.
      Specified by:
      visitArray in interface ElementVisitor
      Parameters:
      entry - the array element to visit.
      Returns:
      the visitor to apply to all array entries.
    • visitObject

      Starts the visit of an object element. The returned element visitor is used to visit each key-value mapping of the object.
      Specified by:
      visitObject in interface ElementVisitor
      Parameters:
      entry - the object element to visit.
      Returns:
      the visitor to apply to all object key-value mappings.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • rootObject

      @NonNull public @NonNull com.google.gson.JsonObject rootObject()
      Returns the value of the rootObject record component.
      Returns:
      the value of the rootObject record component