Class NodeValue<T extends Serializable>
java.lang.Object
com.vaadin.flow.internal.nodefeature.NodeFeature
com.vaadin.flow.internal.nodefeature.NodeValue<T>
- Type Parameters:
T- the type of the stored value
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BasicTypeValue,ShadowRootData,TextNodeMap
A node feature that carries a single value. Represented as a map containing
the key returned by
getKey() on the client.
For internal use only. May be renamed or removed in a future release.
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcollectChanges(Consumer<NodeChange> collector) Collects all changes that are recorded for this feature.voidforEachChild(Consumer<StateNode> action) Passes each child node instance to the given consumer.voidGenerates all changes that would be needed to take this node from its initial empty state to its current state.protected abstract StringgetKey()Gets the key that should be used when the value of this feature is sent to the client.protected TgetValue()Gets the value of this feature.protected voidSets the value of this feature.Methods inherited from class com.vaadin.flow.internal.nodefeature.NodeFeature
allowsChanges, attachPotentialChild, detatchPotentialChild, getNode, onAttach, onDetach
-
Constructor Details
-
NodeValue
Creates a new feature for the given node.- Parameters:
node- the node which supports the feature
-
-
Method Details
-
getKey
Gets the key that should be used when the value of this feature is sent to the client.The key is fetched on demand from the sub class instead of e.g. requiring it as a constructor parameter to avoid storing an additional member field in each instance.
- Returns:
- the key value, not
null
-
setValue
Sets the value of this feature.- Parameters:
value- the value to set
-
getValue
Gets the value of this feature.- Returns:
- the previously set value
-
collectChanges
Description copied from class:NodeFeatureCollects all changes that are recorded for this feature.- Specified by:
collectChangesin classNodeFeature- Parameters:
collector- a consumer accepting node changes
-
generateChangesFromEmpty
public void generateChangesFromEmpty()Description copied from class:NodeFeatureGenerates all changes that would be needed to take this node from its initial empty state to its current state.- Specified by:
generateChangesFromEmptyin classNodeFeature
-
forEachChild
Description copied from class:NodeFeaturePasses each child node instance to the given consumer.- Specified by:
forEachChildin classNodeFeature- Parameters:
action- the consumer that accepts each child
-