Record Class ObjectElement
java.lang.Object
java.lang.Record
eu.cloudnetservice.driver.document.send.element.ObjectElement
- Record Components:
key- the key of this element orElement.NO_KEYif an array entry or the root object.elements- the elements of this object element, each given element must have a key present.
- All Implemented Interfaces:
Element
public record ObjectElement(@NonNull String key, @NonNull @Unmodifiable Collection<? extends Element> elements)
extends Record
implements Element
Represents an object element. An object element contains key-value mappings (can be imagined like a tree).
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @NonNull @Unmodifiable Collection<? extends Element> The field for theelementsrecord component.The field for thekeyrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionObjectElement(@NonNull String key, @NonNull @Unmodifiable Collection<? extends Element> elements) Creates an instance of aObjectElementrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(@NonNull ElementVisitor visitor) Applies the given visitor to this element.@NonNull @Unmodifiable Collection<? extends Element> elements()Returns the value of theelementsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.key()Returns the value of thekeyrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
key
-
elements
The field for theelementsrecord component.
-
-
Constructor Details
-
ObjectElement
public ObjectElement(@NonNull @NonNull String key, @NonNull @NonNull @Unmodifiable Collection<? extends Element> elements) Creates an instance of aObjectElementrecord class.
-
-
Method Details
-
accept
Applies the given visitor to this element. It is up to the implementation (and therefore the element type) to decide what steps should be executed on the given element visitor. -
toString
-
hashCode
-
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). -
key
-
elements
-