Class ComponentInfoBuilder

java.lang.Object
com.vaadin.copilot.javarewriter.ComponentInfoBuilder

public class ComponentInfoBuilder extends Object
Builder pattern for ComponentInfo class
  • Constructor Details

    • ComponentInfoBuilder

      public ComponentInfoBuilder()
  • Method Details

    • type

      public ComponentInfoBuilder type(Class<? extends com.vaadin.flow.component.Component> type)
      Sets the type of the component.
      Parameters:
      type - the Class representing the component type; must not be null.
      Returns:
      the updated ComponentInfoBuilder instance
    • routeConstructor

      public ComponentInfoBuilder routeConstructor(com.github.javaparser.ast.body.ConstructorDeclaration routeConstructor)
      Sets the constructor of the route where the component is created.
      Parameters:
      routeConstructor - the ConstructorDeclaration associated with the component
      Returns:
      the updated ComponentInfoBuilder instance
    • containerComposite

      public ComponentInfoBuilder containerComposite(boolean containerComposite)
      Specifies whether the component is part of a container composite structure.
      Parameters:
      containerComposite - true if it is a container composite, false otherwise
      Returns:
      the updated ComponentInfoBuilder instance
    • isAnonymousComponent

      public ComponentInfoBuilder isAnonymousComponent(boolean isAnonymousComponent)
      Sets whether the component is an anonymous component (i.e., without a named type).
      Parameters:
      isAnonymousComponent - true if it is an anonymous component, false otherwise
      Returns:
      the updated ComponentInfoBuilder instance
    • isReturnValue

      public ComponentInfoBuilder isReturnValue(boolean isReturnValue)
      Specifies whether the component is used as a return value from a method or constructor.
      Parameters:
      isReturnValue - true if the component is a return value, false otherwise
      Returns:
      the updated ComponentInfoBuilder instance
    • createdInLoop

      public ComponentInfoBuilder createdInLoop(boolean createdInLoop)
      Sets whether the component is created inside a loop.
      Parameters:
      createdInLoop - true if created inside a loop, false otherwise
      Returns:
      the updated ComponentInfoBuilder instance
    • customComponentInfo

      public ComponentInfoBuilder customComponentInfo(CustomComponent customComponentInfo)
      Sets custom information associated with the component.
      Parameters:
      customComponentInfo - a CustomComponent instance with additional component metadata, or null if none
      Returns:
      the updated ComponentInfoBuilder instance
    • componentCreateInfo

      public ComponentInfoBuilder componentCreateInfo(ComponentCreateInfo componentCreateInfo)
      Sets the creation information associated with the component.
      Parameters:
      componentCreateInfo - a ComponentCreateInfo instance containing creation details, or null if none
      Returns:
      the updated ComponentInfoBuilder instance
    • componentAttachInfo

      public ComponentInfoBuilder componentAttachInfo(ComponentAttachInfo componentAttachInfo)
      Sets the attachment information associated with the component.
      Parameters:
      componentAttachInfo - a ComponentAttachInfo instance containing attachment details, or null if none
      Returns:
      the updated ComponentInfoBuilder instance
    • createAndAttachLocationsAreInSameFile

      public ComponentInfoBuilder createAndAttachLocationsAreInSameFile(boolean createAndAttachLocationsAreInSameFile)
      Sets whether component create location and attach location are in the same file.
      Parameters:
      createAndAttachLocationsAreInSameFile - true when both refers to same file, false otherwise.
      Returns:
      the updated ComponentInfoBuilder instance
    • classSource

      public ComponentInfoBuilder classSource(boolean classSource)
      Sets whether the component indicates the whole class file rather than instances in the class
      Parameters:
      classSource - true if component info refers to class, false otherwise.
      Returns:
      the updated ComponentInfoBuilder instance
    • isClassSource

      public boolean isClassSource()
      Returns class source value
      Returns:
      true if component info refers to class, false otherwise.
    • getCreateInfoOrThrow

      public ComponentCreateInfo getCreateInfoOrThrow()
      Returns the ComponentCreateInfo if present, or throws an exception if absent.
      Returns:
      the ComponentCreateInfo associated with the component
      Throws:
      IllegalStateException - if the create info is not present
    • getComponentAttachInfoOptional

      public Optional<ComponentAttachInfo> getComponentAttachInfoOptional()
    • build

      public ComponentInfo build()
      Builds a new ComponentInfo instance based on the values set in this builder.
      Returns:
      a new ComponentInfo instance