Class AbstractPropertyMap

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    ElementPropertyMap, ElementStylePropertyMap

    public abstract class AbstractPropertyMap
    extends NodeMap
    Abstract class to be used as a parent for node maps which supports setting properties in a map.

    For internal use only. May be renamed or removed in a future release.

    Since:
    1.0
    Author:
    Vaadin Ltd
    See Also:
    Serialized Form
    • Constructor Detail

      • AbstractPropertyMap

        public AbstractPropertyMap​(StateNode node)
        Creates a new element property map for the given node.
        Parameters:
        node - the node that the map belongs to
    • Method Detail

      • setProperty

        public void setProperty​(String name,
                                Serializable value,
                                boolean emitChange)
        Sets a property to the given value.
        Parameters:
        name - the property name
        value - the value, must be a string, a boolean, a double or null
        emitChange - true to create a change event for the client side
      • hasProperty

        public boolean hasProperty​(String name)
        Checks whether there is a property of the given name.
        Parameters:
        name - the name of the property
        Returns:
        true if there is a property with the given name; false if there is no property
      • removeProperty

        public void removeProperty​(String name)
        Removes the given property.
        Parameters:
        name - the name of the property to remove
      • removeAllProperties

        public void removeAllProperties()
        Removes all properties.
      • getProperty

        public Serializable getProperty​(String name)
        Gets the value of the given property.
        Parameters:
        name - the name of the property
        Returns:
        the property value; null if there is no property or if the value is explicitly set to null
      • getPropertyNames

        public Stream<String> getPropertyNames()
        Gets the property names.
        Returns:
        a stream containing all the property names that have been set
      • isValidValueType

        public static boolean isValidValueType​(Serializable value)
        Checks if the given value is of a supported type.
        Parameters:
        value - the value to check, may be null
        Returns:
        true if the type is supported, false otherwise