Class ComponentUtils

java.lang.Object
com.vaadin.flow.ai.formfiller.utils.ComponentUtils

public class ComponentUtils extends Object
Util class to deal with a component and its children (get children, map hierarchy, map types,...)
Author:
Vaadin Ltd.
  • Constructor Details

    • ComponentUtils

      public ComponentUtils()
  • Method Details

    • createMapping

      public static ComponentUtils.ComponentsMapping createMapping(com.vaadin.flow.component.Component component)
      Creates the mapped structures with the information required to generate the prompt and fill the components after the response. This includes the hierarchy of components and the value types of each component.
      Parameters:
      component - the component target (can be a component or a container of components)
      Returns:
      the mapped structures with the information
    • getComponentInfo

      public static List<ComponentUtils.ComponentInfo> getComponentInfo(com.vaadin.flow.component.Component component)
      Get all the components detailed information from a parent component. ComponentUtils.ComponentInfo includes the component id, type and the component itself.
      Parameters:
      component - target
      Returns:
      List of all component children information
    • getAllChildren

      public static Stream<com.vaadin.flow.component.Component> getAllChildren(com.vaadin.flow.component.Component component)
      Get all children from a parent component
      Parameters:
      component - target
      Returns:
      Stream of all component children
    • fillComponents

      public static void fillComponents(List<ComponentUtils.ComponentInfo> components, Map<String,Object> mapComponentValues)
      Fills the component(s) of the target component using the map with components and values.
      Parameters:
      mapComponentValues - Transformed AI module response to a map with components and values.
    • isSupportedComponent

      public static boolean isSupportedComponent(com.vaadin.flow.component.Component component)