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

    Modifier and Type
    Method
    Description
    default G
    get(HasElement hasElement)
    Gets the property value for the given component.
    get(Element element)
    Gets the property value for the given element.
    Gets the name of the property.
    default void
    set(HasElement hasElement, S value)
    Sets the property value for the given component.
    void
    set(Element element, S value)
    Sets the property value for the given element.
  • Method Details

    • 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