Record Class GsonObjectVisitor
java.lang.Object
java.lang.Record
eu.cloudnetservice.driver.document.gson.send.GsonObjectVisitor
- Record Components:
targetObject- the target gson json object to put all visited elements into.
- All Implemented Interfaces:
ElementVisitor
record GsonObjectVisitor(@NonNull com.google.gson.JsonObject targetObject)
extends Record
implements ElementVisitor
An element visitor specifically made to transform all given values into a gson json object.
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @NonNull com.google.gson.JsonObjectThe field for thetargetObjectrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionGsonObjectVisitor(@NonNull com.google.gson.JsonObject targetObject) Creates an instance of aGsonObjectVisitorrecord 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.JsonObjectReturns the value of thetargetObjectrecord 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
-
targetObject
The field for thetargetObjectrecord component.
-
-
Constructor Details
-
GsonObjectVisitor
Creates an instance of aGsonObjectVisitorrecord class.- Parameters:
targetObject- the value for thetargetObjectrecord 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). -
targetObject
Returns the value of thetargetObjectrecord component.- Returns:
- the value of the
targetObjectrecord component
-