Class ComponentInfoFinder

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

public class ComponentInfoFinder extends Object
Responsible for locating and aggregating information about a UI component's creation and attachment within a Java project.

This class uses a ProjectFileManager and ComponentTypeAndSourceLocation to determine where a component is created and (optionally) where it is attached, then compiles that information into a ComponentInfo object.

  • Constructor Details

    • ComponentInfoFinder

      public ComponentInfoFinder(JavaFileSourceProvider javaFileSourceProvider, ComponentTypeAndSourceLocation componentTypeAndSourceLocation)
      Constructs a ComponentInfoFinder using the default ProjectFileManager instance and the given component source metadata.
      Parameters:
      componentTypeAndSourceLocation - metadata describing the component's type and source locations
  • Method Details

    • find

      public ComponentInfo find() throws IOException
      Finds and compiles information about a component's creation and (if applicable) attachment in the project.

      This method:

      • Loads the Java source file where the component is created
      • Extracts related creation details
      • If available, loads the Java source file where the component is attached and extracts attachment details
      Returns:
      a ComponentInfo object containing the collected creation and attachment data
      Throws:
      IOException - if any source file could not be read
    • createAttachInfo

      public static ComponentAttachInfo createAttachInfo(JavaSource javaSource, AttachExpression attachCall, com.github.javaparser.ast.stmt.BlockStmt componentAttachScope, ComponentCreateInfo createInfo)
    • createComponentCreateInfo

      public static ComponentCreateInfo createComponentCreateInfo(JavaSource javaSource, com.github.javaparser.ast.expr.ObjectCreationExpr objectCreationExpr)