com.vaadin.flow.internal.nodefeature.
Class NodeValue<T extends Serializable>
Type Parameters:
T
- the type of the stored value
All Implemented Interfaces:
Direct Known Subclasses:
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 TypeMethodDescriptionvoid
collectChanges
(Consumer<NodeChange> collector) Collects all changes that are recorded for this feature.
void
forEachChild
(Consumer<StateNode> action) Passes each child node instance to the given consumer.
void
Generates all changes that would be needed to take this node from its initial empty state to its current state.
protected abstract String
getKey()
Gets the key that should be used when the value of this feature is sent to the client.
protected T
getValue()
Gets the value of this feature.
protected void
Sets 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:
NodeFeature
Collects all changes that are recorded for this feature.
Specified by:
collectChanges
in classNodeFeature
Parameters:
collector
- a consumer accepting node changes -
generateChangesFromEmpty
public void generateChangesFromEmpty()Description copied from class:
NodeFeature
Generates all changes that would be needed to take this node from its initial empty state to its current state.
Specified by:
generateChangesFromEmpty
in classNodeFeature
-
forEachChild
Description copied from class:
NodeFeature
Passes each child node instance to the given consumer.
Specified by:
forEachChild
in classNodeFeature
Parameters:
action
- the consumer that accepts each child
-