Package com.vaadin.copilot.javarewriter
Record Class JavaComponent
java.lang.Object
java.lang.Record
com.vaadin.copilot.javarewriter.JavaComponent
- Record Components:
tag
- the tag of the component, used to determine the Java classclassName
- the class name if known, or null to use the tag to look up the classprops
- the properties of the componentchildren
- the child components
public record JavaComponent(String tag, String className, Map<String,Object> props, List<JavaComponent> children)
extends Record
Represents a Java component to be added to the source code.
-
Constructor Summary
ConstructorsConstructorDescriptionJavaComponent
(String tag, String className, Map<String, Object> props, List<JavaComponent> children) Creates an instance of aJavaComponent
record class. -
Method Summary
Modifier and TypeMethodDescriptionchildren()
Returns the value of thechildren
record component.Returns the value of theclassName
record component.static JavaComponent
componentFromJson
(elemental.json.JsonObject json) Creates a new JavaComponent instance from a JSON object.static List<JavaComponent>
componentsFromJson
(elemental.json.JsonArray template) Creates a new JavaComponent instance from a JSON array.final boolean
Indicates whether some other object is "equal to" this one.return items of a component if they exist as a propertyfinal int
hashCode()
Returns a hash code value for this object.props()
Returns the value of theprops
record component.tag()
Returns the value of thetag
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
withTag
-
componentFromJson
Creates a new JavaComponent instance from a JSON object.- Parameters:
json
- the JSON object- Returns:
- the JavaComponent instance
-
componentsFromJson
Creates a new JavaComponent instance from a JSON array.- Parameters:
template
- the JSON array- Returns:
- the JavaComponent instances
-
getItemsFromProperty
return items of a component if they exist as a property- Returns:
- the tag
-
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)
. -
tag
Returns the value of thetag
record component.- Returns:
- the value of the
tag
record component
-
className
Returns the value of theclassName
record component.- Returns:
- the value of the
className
record component
-
props
Returns the value of theprops
record component.- Returns:
- the value of the
props
record component
-
children
Returns the value of thechildren
record component.- Returns:
- the value of the
children
record component
-