com.vaadin.copilot.javarewriter.
Record Class JavaComponent
Record Components:
tag
- the tag of the component, used to determine the Java class
className
- the class name if known, or null to use the tag to look up the class
props
- the properties of the component
children
- the child components
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 a
JavaComponent
record class. -
Method Summary
Modifier and TypeMethodDescriptionchildren()
Returns the value of the
children
record component.Returns the value of the
className
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 property
final int
hashCode()
Returns a hash code value for this object.
props()
Returns the value of the
props
record component.tag()
Returns the value of the
tag
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 objectReturns:
the JavaComponent instance
-
componentsFromJson
Creates a new JavaComponent instance from a JSON array.
Parameters:
template
- the JSON arrayReturns:
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 with
Objects::equals(Object,Object)
. -
tag
Returns the value of the
tag
record component.Returns:
the value of the
tag
record component -
className
Returns the value of the
className
record component.Returns:
the value of the
className
record component -
props
Returns the value of the
props
record component.Returns:
the value of the
props
record component -
children
Returns the value of the
children
record component.Returns:
the value of the
children
record component
-