Interface AllComponentsComponentGenerator

All Known Implementing Classes:
AbbrAllComponentsComponentGenerator, AccordionAllComponentsComponentGenerator, AccordionPanelAllComponentsComponentGenerator, AnchorAllComponentsComponentGenerator, ArticleAllComponentsComponentGenerator, AsideAllComponentsComponentGenerator, AvatarGroupAllComponentsComponentGenerator, BadgeAllComponentsComponentGenerator, CardAllComponentsComponentGenerator, ChartAllComponentsComponentGenerator, CheckboxGroupAllComponentsComponentGenerator, CodeAllComponentsComponentGenerator, ConfirmDialogAllComponentsComponentGenerator, ContextMenuAllComponentsComponentGenerator, DashboardAllComponentsComponentGenerator, DateTimePickerAllComponentsComponentGenerator, DefaultAllComponentsComponentGenerator, DescriptionListAllComponentsComponentGenerator, DetailsAllComponentsComponentGenerator, DialogAllComponentsComponentGenerator, FieldSetAllComponentsComponentGenerator, FormLayoutAllComponentsComponentGenerator, GridAllComponentsComponentGenerator, IconAllComponentsComponentGenerator, IFrameAllComponentsComponentGenerator, ImageAllComponentsComponentGenerator, ListItemAllComponentsComponentGenerator, MapAllComponentsComponentGenerator, MarkdownAllComponentsComponentGenerator, MenuBarAllComponentsComponentGenerator, MessageListAllComponentsComponentGenerator, NativeDetailsAllComponentsComponentGenerator, NavAllComponentsComponentGenerator, NotificationAllComponentsComponentGenerator, OrderedListAllComponentsComponentGenerator, ParamAllComponentsComponentGenerator, PopoverAllComponentsComponentGenerator, PreAllComponentsComponentGenerator, ProgressBarAllComponentsComponentGenerator, RichTextEditorAllComponentsComponentGenerator, SectionAllComponentsComponentGenerator, SideNavAllComponentsComponentGenerator, SplitLayoutAllComponentsComponentGenerator, TabAllComponentsComponentGenerator, TabsAllComponentsComponentGenerator, TabSheetAllComponentsComponentGenerator, UnorderedListAllComponentsComponentGenerator

public interface AllComponentsComponentGenerator
Provides component-specific behavior while generating a All Components view. Implementations identify the component class they support and can customize example generation, styling, and generated statements.
  • Method Details

    • targetFullyQualifiedClassName

      String targetFullyQualifiedClassName()
      Gets the fully qualified name of the component class targeted by this generator.
      Returns:
      the target class name, or null when the generator is the default fallback
    • matches

      default boolean matches(Class<?> componentClazz, List<Class<?>> inheritanceChain)
      Determines whether this generator supports a component class.
      Parameters:
      componentClazz - the component class being generated
      inheritanceChain - the component class and its superclasses
      Returns:
      true when the target class matches the component or one of its superclasses
    • shouldGenerateExample

      default boolean shouldGenerateExample(Class<?> componentClazz)
      Determines whether an example should be generated for a component.
      Parameters:
      componentClazz - the component class being generated
      Returns:
      true to generate an example
    • populateForEachThemeVariant

      default boolean populateForEachThemeVariant(Class<?> componentClazz)
      Determines whether examples should be populated for every available theme variant.
      Parameters:
      componentClazz - the component class being generated
      Returns:
      true to generate examples for each theme variant
    • addDefaultWithoutVariant

      default boolean addDefaultWithoutVariant(Class<?> componentClazz)
      Determines whether an example without a theme variant should be added.
      Parameters:
      componentClazz - the component class being generated
      Returns:
      true to add the default example
    • styles

      default Map<String,String> styles(Class<?> componentClazz)
      Gets inline styles to apply to generated component instances.
      Parameters:
      componentClazz - the component class being generated
      Returns:
      CSS property names and values to apply
    • addCustomStatements

      default void addCustomStatements(AllComponentsComponentGeneratorContext context)
      Adds component-specific statements to the generated example.
      Parameters:
      context - context containing the generated block and component details
    • maxShowcaseColumns

      default int maxShowcaseColumns(Class<?> componentClazz)
      Gets the maximum number of columns for the component's showcase grid. Wide components should return 1 so each example spans the full card width.
      Parameters:
      componentClazz - the component class being generated
      Returns:
      the maximum column count, 3 by default
    • hasMethod

      default boolean hasMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes)
      Checks whether a class has a public method with compatible parameter types.
      Parameters:
      clazz - the class to inspect
      methodName - the method name to find
      parameterTypes - argument types that must be accepted by the method
      Returns:
      true if a compatible method exists
    • hasMethodWithParameterTypeNames

      default boolean hasMethodWithParameterTypeNames(Class<?> clazz, String methodName, String... parameterTypeNames)
      Checks whether a class has a public method with parameters matching the supplied fully qualified type names.
      Parameters:
      clazz - the class to inspect
      methodName - the method name to find
      parameterTypeNames - fully qualified parameter type names to match
      Returns:
      true if a matching method exists
    • parametersMatch

      default boolean parametersMatch(Method method, Class<?>... parameterTypes)
      Determines whether a method accepts the supplied argument types.
      Parameters:
      method - the method to inspect
      parameterTypes - argument types that must be accepted by the method
      Returns:
      true if the parameter counts match and every argument type is assignable to the corresponding method parameter
    • parameterNamesMatch

      default boolean parameterNamesMatch(Method method, String... parameterTypeNames)
      Determines whether a method has parameters with the supplied fully qualified type names.
      Parameters:
      method - the method to inspect
      parameterTypeNames - fully qualified parameter type names to match
      Returns:
      true if the parameter counts and type names match
    • getVariantExpression

      default Optional<String> getVariantExpression(AllComponentsComponentGeneratorContext context, String variableName)
      Gets the variant name from the addThemeVariants call
      Parameters:
      context - Context of the target component
      variableName - Variable name to find addThemeVariants call
      Returns:
      String theme variant e.g. LUMO_PRIMARY
    • getVariantNameExpressionOrDefaultStringLiteral

      default String getVariantNameExpressionOrDefaultStringLiteral(AllComponentsComponentGeneratorContext context, String variableName, String defaultVarName)
      Generates formatVariantName call for components that have addThemeVariants call.
      Parameters:
      context - Context of the target component
      variableName - Variable name to find addThemeVariantsCall
      defaultVarName - Fallback name when there is no theme variants
      Returns:
      the variant name as string literal or variant name expr