Class AbstractPropertyMap
- java.lang.Object
-
- com.vaadin.flow.internal.nodefeature.NodeFeature
-
- com.vaadin.flow.internal.nodefeature.NodeMap
-
- com.vaadin.flow.internal.nodefeature.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 Summary
Constructors Constructor Description AbstractPropertyMap(StateNode node)
Creates a new element property map for the given node.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Serializable
getProperty(String name)
Gets the value of the given property.Stream<String>
getPropertyNames()
Gets the property names.boolean
hasProperty(String name)
Checks whether there is a property of the given name.static boolean
isValidValueType(Serializable value)
Checks if the given value is of a supported type.void
removeAllProperties()
Removes all properties.void
removeProperty(String name)
Removes the given property.void
setProperty(String name, Serializable value, boolean emitChange)
Sets a property to the given value.-
Methods inherited from class com.vaadin.flow.internal.nodefeature.NodeMap
clear, collectChanges, contains, forEachChild, generateChangesFromEmpty, get, getOrDefault, getOrDefault, getOrDefault, keySet, mayUpdateFromClient, producePutChange, put, put, remove, updateFromClient
-
Methods inherited from class com.vaadin.flow.internal.nodefeature.NodeFeature
allowsChanges, attachPotentialChild, detatchPotentialChild, getNode, onAttach, onDetach
-
-
-
-
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 namevalue
- the value, must be a string, a boolean, a double ornull
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
-
-