Record Class ComponentInfo

java.lang.Object
java.lang.Record
com.vaadin.copilot.javarewriter.ComponentInfo
Record Components:
type - the Class type of the component
routeConstructor - the ConstructorDeclaration associated with the component's creation
containerComposite - true if the component is a container composite
isAnonymousComponent - true if the component is an anonymous class
isReturnValue - true if the component is the return value of a method
createdInLoop - true if the component is created inside a loop
customComponentInfo - optional metadata about custom components
componentCreateInfoOptional - optional metadata about the component's creation process
componentAttachInfoOptional - optional metadata about the component's attachment lifecycle

public record ComponentInfo(Class<? extends com.vaadin.flow.component.Component> type, com.github.javaparser.ast.body.ConstructorDeclaration routeConstructor, boolean containerComposite, boolean isAnonymousComponent, boolean isReturnValue, boolean createdInLoop, boolean createAndAttachLocationsAreInSameFile, Optional<CustomComponent> customComponentInfo, Optional<ComponentCreateInfo> componentCreateInfoOptional, Optional<ComponentAttachInfo> componentAttachInfoOptional) extends Record
Represents metadata information about a Vaadin Component.

This record aggregates various details about a component's structure, creation, and attachment lifecycle, including information about whether it is a container composite, anonymous, a return value from a method, created inside a loop, and associated custom metadata.

  • Constructor Details

    • ComponentInfo

      public ComponentInfo(Class<? extends com.vaadin.flow.component.Component> type, com.github.javaparser.ast.body.ConstructorDeclaration routeConstructor, boolean containerComposite, boolean isAnonymousComponent, boolean isReturnValue, boolean createdInLoop, boolean createAndAttachLocationsAreInSameFile, Optional<CustomComponent> customComponentInfo, Optional<ComponentCreateInfo> componentCreateInfoOptional, Optional<ComponentAttachInfo> componentAttachInfoOptional)
      Creates an instance of a ComponentInfo record class.
      Parameters:
      type - the value for the type record component
      routeConstructor - the value for the routeConstructor record component
      containerComposite - the value for the containerComposite record component
      isAnonymousComponent - the value for the isAnonymousComponent record component
      isReturnValue - the value for the isReturnValue record component
      createdInLoop - the value for the createdInLoop record component
      createAndAttachLocationsAreInSameFile - the value for the createAndAttachLocationsAreInSameFile record component
      customComponentInfo - the value for the customComponentInfo record component
      componentCreateInfoOptional - the value for the componentCreateInfoOptional record component
      componentAttachInfoOptional - the value for the componentAttachInfoOptional record component
  • Method Details

    • getAttachCallInSameFileOrThrow

      public AttachExpression getAttachCallInSameFileOrThrow()
    • getComponentAttachScopeOrThrowIfDifferentFile

      public Optional<com.github.javaparser.ast.stmt.BlockStmt> getComponentAttachScopeOrThrowIfDifferentFile()
    • getCreateInfoOrThrow

      public ComponentCreateInfo getCreateInfoOrThrow()
    • getCreateLocationFileOrThrowIfNull

      public File getCreateLocationFileOrThrowIfNull()
    • getCreateLocationCompilationUnitOrThrowIfNull

      public com.github.javaparser.ast.CompilationUnit getCreateLocationCompilationUnitOrThrowIfNull()
    • getAttachLocationCompilationUnitOrThrowIfNull

      public com.github.javaparser.ast.CompilationUnit getAttachLocationCompilationUnitOrThrowIfNull()
    • getVariableDeclarator

      public com.github.javaparser.ast.body.VariableDeclarator getVariableDeclarator()
      Gets the variable declarator of the component, either for the local variable or field.
      Returns:
      the variable declarator of the component, or null if not found
    • typeWithGenerics

      public String typeWithGenerics()
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • type

      public Class<? extends com.vaadin.flow.component.Component> type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • routeConstructor

      public com.github.javaparser.ast.body.ConstructorDeclaration routeConstructor()
      Returns the value of the routeConstructor record component.
      Returns:
      the value of the routeConstructor record component
    • containerComposite

      public boolean containerComposite()
      Returns the value of the containerComposite record component.
      Returns:
      the value of the containerComposite record component
    • isAnonymousComponent

      public boolean isAnonymousComponent()
      Returns the value of the isAnonymousComponent record component.
      Returns:
      the value of the isAnonymousComponent record component
    • isReturnValue

      public boolean isReturnValue()
      Returns the value of the isReturnValue record component.
      Returns:
      the value of the isReturnValue record component
    • createdInLoop

      public boolean createdInLoop()
      Returns the value of the createdInLoop record component.
      Returns:
      the value of the createdInLoop record component
    • createAndAttachLocationsAreInSameFile

      public boolean createAndAttachLocationsAreInSameFile()
      Returns the value of the createAndAttachLocationsAreInSameFile record component.
      Returns:
      the value of the createAndAttachLocationsAreInSameFile record component
    • customComponentInfo

      public Optional<CustomComponent> customComponentInfo()
      Returns the value of the customComponentInfo record component.
      Returns:
      the value of the customComponentInfo record component
    • componentCreateInfoOptional

      public Optional<ComponentCreateInfo> componentCreateInfoOptional()
      Returns the value of the componentCreateInfoOptional record component.
      Returns:
      the value of the componentCreateInfoOptional record component
    • componentAttachInfoOptional

      public Optional<ComponentAttachInfo> componentAttachInfoOptional()
      Returns the value of the componentAttachInfoOptional record component.
      Returns:
      the value of the componentAttachInfoOptional record component