Class PropertyDescriptors


  • public final class PropertyDescriptors
    extends Object
    Factory methods for creating PropertyDescriptor instances.
    Since:
    1.0
    Author:
    Vaadin Ltd
    • Method Detail

      • propertyWithDefault

        public static PropertyDescriptor<String,​String> propertyWithDefault​(String name,
                                                                                  String defaultValue)
        Creates a descriptor for a property of the component's root element with a non-null default value.
        Parameters:
        name - the name of the element property, not null
        defaultValue - the default value of the property, not null
        Returns:
        a property descriptor, not null
      • propertyWithDefault

        public static PropertyDescriptor<Integer,​Integer> propertyWithDefault​(String name,
                                                                                    Integer defaultValue)
        Creates a descriptor for a property of the component's root element with a non-null default value.
        Parameters:
        name - the name of the element property, not null
        defaultValue - the default value of the property, not null
        Returns:
        a property descriptor, not null
      • propertyWithDefault

        public static PropertyDescriptor<Double,​Double> propertyWithDefault​(String name,
                                                                                  Double defaultValue)
        Creates a descriptor for a property of the component's root element with a non-null default value.
        Parameters:
        name - the name of the element property, not null
        defaultValue - the default value of the property, not null
        Returns:
        a property descriptor, not null
      • propertyWithDefault

        public static PropertyDescriptor<Boolean,​Boolean> propertyWithDefault​(String name,
                                                                                    Boolean defaultValue)
        Creates a descriptor for a property of the component's root element with a non-null default value.
        Parameters:
        name - the name of the element property, not null
        defaultValue - the default value of the property, not null
        Returns:
        a property descriptor, not null
      • attributeWithDefault

        public static PropertyDescriptor<String,​String> attributeWithDefault​(String name,
                                                                                   String defaultValue)
        Creates a descriptor for an attribute of the component's root element with a non-null default value.
        Parameters:
        name - the name of the element attribute, not null
        defaultValue - the default value of the property, not null
        Returns:
        a property descriptor, not null
      • attributeWithDefault

        public static PropertyDescriptor<String,​String> attributeWithDefault​(String name,
                                                                                   String defaultValue,
                                                                                   boolean removeDefault)
        Creates a descriptor for an attribute of the component's root element with a non-null default value.
        Parameters:
        name - the name of the element attribute, not null
        defaultValue - the default value of the property, not null
        removeDefault - if true then attribute with default value will be removed, otherwise attribute with the default value will be kept as is
        Returns:
        a property descriptor, not null
      • optionalAttributeWithDefault

        public static PropertyDescriptor<String,​Optional<String>> optionalAttributeWithDefault​(String name,
                                                                                                     String defaultValue)
        Creates a descriptor for an optional attribute of the component's root element with a non-null default value. The getter will return an empty optional if the element doesn't have the attribute, or if its value is the default value.
        Parameters:
        name - the name of the element attribute, not null
        defaultValue - the default value of the property, not null
        Returns:
        a property descriptor, not null
      • optionalAttributeWithDefault

        public static PropertyDescriptor<String,​Optional<String>> optionalAttributeWithDefault​(String name,
                                                                                                     String defaultValue,
                                                                                                     boolean removeDefault)
        Creates a descriptor for an optional attribute of the component's root element with a non-null default value. The getter will return an empty optional if the element doesn't have the attribute, or if its value is the default value.
        Parameters:
        name - the name of the element attribute, not null
        defaultValue - the default value of the property, not null
        removeDefault - if true then attribute with default value will be removed, otherwise attribute with the default value will be kept as is
        Returns:
        a property descriptor, not null