Record Class GsonArrayVisitor
java.lang.Object
java.lang.Record
eu.cloudnetservice.driver.document.gson.send.GsonArrayVisitor
- Record Components:
targetArray- the target gson json array to put all visited elements into.
- All Implemented Interfaces:
ElementVisitor
record GsonArrayVisitor(@NonNull com.google.gson.JsonArray targetArray)
extends Record
implements ElementVisitor
An element visitor specifically made to transform all given values into a gson json array.
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @NonNull com.google.gson.JsonArrayThe field for thetargetArrayrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionGsonArrayVisitor(@NonNull com.google.gson.JsonArray targetArray) Creates an instance of aGsonArrayVisitorrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@NonNull com.google.gson.JsonArrayReturns the value of thetargetArrayrecord component.final StringtoString()Returns a string representation of this record class.visitArray(@NonNull ArrayElement entry) Starts the visit of an array element.voidvisitEnd()Called when the end of visit for this visitor is reached.voidvisitNull(@NonNull NullElement entry) Visits a null element.visitObject(@NonNull ObjectElement entry) Starts the visit of an object element.voidVisits a primitive element.
-
Field Details
-
targetArray
The field for thetargetArrayrecord component.
-
-
Constructor Details
-
GsonArrayVisitor
Creates an instance of aGsonArrayVisitorrecord class.- Parameters:
targetArray- the value for thetargetArrayrecord 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:
visitEndin interfaceElementVisitor
-
visitNull
Visits a null element.- Specified by:
visitNullin interfaceElementVisitor- Parameters:
entry- the null element to visit.
-
visitPrimitive
Visits a primitive element.- Specified by:
visitPrimitivein interfaceElementVisitor- 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:
visitArrayin interfaceElementVisitor- 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:
visitObjectin interfaceElementVisitor- Parameters:
entry- the object element to visit.- Returns:
- the visitor to apply to all object key-value mappings.
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
targetArray
Returns the value of thetargetArrayrecord component.- Returns:
- the value of the
targetArrayrecord component
-