Package com.vaadin.copilot.allcomponents
Class AllComponentsViewTemplateGenerator
java.lang.Object
com.vaadin.copilot.allcomponents.AllComponentsViewTemplateGenerator
Generates the Java source for a runtime All Components view.
The generator creates a routed view containing grouped component showcase cards. It selects component-specific generators where available and falls back to the default generator for all other component types.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordAssociates component metadata with its resolved runtime class. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a generator with the built-in component-specific generators. -
Method Summary
Modifier and TypeMethodDescriptiongenerateEmptyTemplate(String viewClassName, String route) Generates an empty All Components view with information about the tool.generateEmptyTemplate(String viewClassName, String route, String applicationMainRoute) Generates an empty All Components view and adds a return control when the application has a root route.generateTemplate(String viewClassName, String route, List<UserApplicationComponentFinder.ClassNameInfo> classNameInfos) Generates source code for an All Components view.generateTemplate(String viewClassName, String route, List<UserApplicationComponentFinder.ClassNameInfo> classNameInfos, String applicationMainRoute) Generates source code for an All Components view and adds a return control when the application has a root route.
-
Constructor Details
-
AllComponentsViewTemplateGenerator
public AllComponentsViewTemplateGenerator()Creates a generator with the built-in component-specific generators.
-
-
Method Details
-
generateTemplate
public String generateTemplate(String viewClassName, String route, List<UserApplicationComponentFinder.ClassNameInfo> classNameInfos) Generates source code for an All Components view.Components that cannot be resolved or instantiated with a default constructor are omitted from the generated view.
- Parameters:
viewClassName- simple name for the generated view classroute- route assigned to the generated viewclassNameInfos- components to include in the generated view- Returns:
- Java source code for the generated All Components view
-
generateTemplate
public String generateTemplate(String viewClassName, String route, List<UserApplicationComponentFinder.ClassNameInfo> classNameInfos, String applicationMainRoute) Generates source code for an All Components view and adds a return control when the application has a root route.- Parameters:
viewClassName- View class name aligns with the corresponding file nameroute- Path to navigateapplicationMainRoute- application's root route, if one is registered- Returns:
- Generated class code that can be written to a file without a package definition.
-
generateEmptyTemplate
Generates an empty All Components view with information about the tool.- Parameters:
viewClassName- simple name for the generated view classroute- route assigned to the generated view- Returns:
- Java source code for the empty All Components view
-
generateEmptyTemplate
public String generateEmptyTemplate(String viewClassName, String route, String applicationMainRoute) Generates an empty All Components view and adds a return control when the application has a root route.- Parameters:
applicationMainRoute- application's root route, if one is registered
-