Package com.vaadin.copilot.javarewriter
Class ComponentInfoFinder
java.lang.Object
com.vaadin.copilot.javarewriter.ComponentInfoFinder
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 Summary
ConstructorsConstructorDescriptionComponentInfoFinder(JavaFileSourceProvider javaFileSourceProvider, ComponentTypeAndSourceLocation componentTypeAndSourceLocation) Constructs aComponentInfoFinderusing the defaultProjectFileManagerinstance and the given component source metadata. -
Method Summary
Modifier and TypeMethodDescriptionstatic ComponentAttachInfocreateAttachInfo(JavaSource javaSource, AttachExpression attachCall, com.github.javaparser.ast.stmt.BlockStmt componentAttachScope, ComponentCreateInfo createInfo) static ComponentCreateInfocreateComponentCreateInfo(JavaSource javaSource, com.github.javaparser.ast.expr.ObjectCreationExpr objectCreationExpr) find()Finds and compiles information about a component's creation and (if applicable) attachment in the project.
-
Constructor Details
-
ComponentInfoFinder
public ComponentInfoFinder(JavaFileSourceProvider javaFileSourceProvider, ComponentTypeAndSourceLocation componentTypeAndSourceLocation) Constructs aComponentInfoFinderusing the defaultProjectFileManagerinstance and the given component source metadata.- Parameters:
componentTypeAndSourceLocation- metadata describing the component's type and source locations
-
-
Method Details
-
find
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
ComponentInfoobject 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)
-