com.vaadin.flow.internal.nodefeature.
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 valueAll Implemented Interfaces:
Direct Known Subclasses:
public abstract class NodeValue<T extends Serializable> extends NodeFeature
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:
-
-
Method Summary
All Methods Modifier and Type Method Description void
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
generateChangesFromEmpty()
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
setValue(T value)
Sets the value of this feature.
-
Methods inherited from class com.vaadin.flow.internal.nodefeature.NodeFeature
allowsChanges, attachPotentialChild, detatchPotentialChild, getNode, onAttach, onDetach
-
-
-
-
Constructor Detail
-
NodeValue
public NodeValue(StateNode node)
Creates a new feature for the given node.
Parameters:
node
- the node which supports the feature
-
-
Method Detail
-
getKey
protected abstract String 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
protected void setValue(T value)
Sets the value of this feature.
Parameters:
value
- the value to set
-
getValue
protected T getValue()
Gets the value of this feature.
Returns:
the previously set value
-
collectChanges
public void collectChanges(Consumer<NodeChange> collector)
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
public void forEachChild(Consumer<StateNode> action)
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
-
-