com.vaadin.flow.internal.

Class NullOwner

  • All Implemented Interfaces:

    NodeOwner, Serializable


    public class NullOwner
    extends Object
    implements NodeOwner

    A stateless singleton node owner that is used for nodes that have not yet been attached to a state tree. An instance of this type is used instead of a null pointer to avoid cluttering implementations with null checks.

    Since:

    1.0

    Author:

    Vaadin Ltd

    See Also:

    Serialized Form

    • Method Detail

      • get

        public static NullOwner get()

        Gets the singleton null owner instance.

        Returns:

        the singleton instance

      • register

        public int register(StateNode node)

        Description copied from interface: NodeOwner

        Registers a node with this node owner. The new node should already be set to be owned by this instance.

        Specified by:

        register in interface NodeOwner

        Parameters:

        node - the node to register

        Returns:

        the id of the registered node

      • unregister

        public void unregister(StateNode node)

        Description copied from interface: NodeOwner

        Unregisters a node from this owner. This must be done before the node is set to not be owned by this instance.

        Specified by:

        unregister in interface NodeOwner

        Parameters:

        node - the node to unregister

      • hasNode

        public boolean hasNode(StateNode node)

        Description copied from interface: NodeOwner

        Check if given node is registered to this node owner.

        Specified by:

        hasNode in interface NodeOwner

        Parameters:

        node - node to check registration status for

        Returns:

        true if node is registered