Class FlowComponentDefaultValueCache

java.lang.Object
com.vaadin.copilot.plugins.propertypanel.FlowComponentDefaultValueCache

public class FlowComponentDefaultValueCache extends Object
Collects and caches default values of a component by instantiating a new instance from Class and by calling getter methods
  • Method Details

    • getInstance

      public static FlowComponentDefaultValueCache getInstance()
    • getDefaultPropertyValue

      public Optional<Object> getDefaultPropertyValue(com.vaadin.flow.component.Component component, String propertyName) throws IntrospectionException
      Retrieves the default value of a specified property for a given component.

      If the default values for the component's class have not been cached yet, this method invokes collectDefaultProperties to compute and cache them. Then, it attempts to retrieve the default value for the specified property name from the cache.

      Parameters:
      component - the UI component whose property's default value is being queried
      propertyName - the name of the property to look up
      Returns:
      an Optional containing the default value of the property if available, or an empty Optional if the property is not found
      Throws:
      IntrospectionException - if an error occurs while introspecting the component to collect its default properties