com.vaadin.flow.component.

Interface PropertyDescriptor<S,G>

  • Type Parameters:

    S - the type used when setting the property value

    G - the type used when getting the property value, this is typically either S or Optional<S>

    All Superinterfaces:

    Serializable


    public interface PropertyDescriptor<S,G>
    extends Serializable

    Describes a component property that has its value stored in some form in the component's element, typically an element property or attribute. The descriptor encapsulates details like default value handling and how to return an optional value so that those settings wouldn't have to be spread out among individual setter and getter implementations in the component's API.

    Use the factory methods in PropertyDescriptors to create property descriptor instances.

    Since:

    1.0

    Author:

    Vaadin Ltd

    • Method Summary

      All Methods
      Modifier and Type Method and Description
      G get(Element element)

      Gets the property value for the given element.

      default G get(HasElement hasElement)

      Gets the property value for the given component.

      String getPropertyName()

      Gets the name of the property.

      void set(Element element, S value)

      Sets the property value for the given element.

      default void set(HasElement hasElement, S value)

      Sets the property value for the given component.

    • Method Detail

      • set

        default void set(HasElement hasElement,
                         S value)

        Sets the property value for the given component.

        Parameters:

        hasElement - the component for which to set the value, not null

        value - the property value to set

      • set

        void set(Element element,
                 S value)

        Sets the property value for the given element.

        Parameters:

        element - the element for which to set the value, not null

        value - the property value to set

      • get

        default G get(HasElement hasElement)

        Gets the property value for the given component.

        Parameters:

        hasElement - the component for which to get the value, not null

        Returns:

        the property value

      • get

        G get(Element element)

        Gets the property value for the given element.

        Parameters:

        element - the element for which to get the value, not null

        Returns:

        the property value

      • getPropertyName

        String getPropertyName()

        Gets the name of the property.

        Returns:

        the property name