T
- the type of the stored valuepublic abstract class NodeValue<T extends Serializable> extends NodeFeature
getKey()
on the client.
For internal use only. May be renamed or removed in a future release.
Constructor and Description |
---|
NodeValue(StateNode node)
Creates a new feature for the given node.
|
Modifier and Type | Method and 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.
|
allowsChanges, attachPotentialChild, detatchPotentialChild, getNode, onAttach, onDetach
public NodeValue(StateNode node)
node
- the node which supports the featureprotected abstract String getKey()
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.
null
protected void setValue(T value)
value
- the value to setprotected T getValue()
public void collectChanges(Consumer<NodeChange> collector)
NodeFeature
collectChanges
in class NodeFeature
collector
- a consumer accepting node changespublic void generateChangesFromEmpty()
NodeFeature
generateChangesFromEmpty
in class NodeFeature
public void forEachChild(Consumer<StateNode> action)
NodeFeature
forEachChild
in class NodeFeature
action
- the consumer that accepts each childCopyright © 2023. All rights reserved.