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

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:
  • Constructor Details

    • NodeValue

      public NodeValue(StateNode node)
      Creates a new feature for the given node.
      Parameters:
      node - the node which supports the feature
  • Method Details

    • 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 class NodeFeature
      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 class NodeFeature
    • 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 class NodeFeature
      Parameters:
      action - the consumer that accepts each child