Interface EventHandler

  • All Known Implementing Classes:
    DefaultEventHandler, FilteredHandler

    public interface EventHandler
    Handler of content change events. Used to decouple processing of changes from the content diff logic that detects them.

    As the content diff recurses down the content tree, it will call the getChildHandler(String, NodeState, NodeState) method to specialize the handler instance for each node under which changes are detected. The other handler methods always apply to the properties and direct children of the node for which that handler instance is specialized. The handler is expected to keep track of contextual information like the path or identifier of the current node based on the sequence of those specialization calls.

    The events belonging to this instance should be delivered before events to other instance deeper down the tree are delivered.

    All names and paths passed to handler methods use unmapped Oak names.

    • Method Detail

      • enter

        void enter​(NodeState before,
                   NodeState after)
        Called before the given before and after states are compared. The implementation can use this method to initialize any internal state needed for processing the results of the comparison.
        Parameters:
        before - before state, non-existent if this node was added
        after - after state, non-existent if this node was removed
      • leave

        void leave​(NodeState before,
                   NodeState after)
        Called after the given before and after states are compared. The implementation can use this method to post-process information collected during the content diff.
        Parameters:
        before - before state, non-existent if this node was added
        after - after state, non-existent if this node was removed
      • getChildHandler

        @Nullable
        @Nullable EventHandler getChildHandler​(java.lang.String name,
                                               NodeState before,
                                               NodeState after)
        Returns a handler of events within the given child node, or null if changes within that child are not to be processed.
        Parameters:
        name - name of the child node
        before - before state of the child node, possibly non-existent
        after - after state of the child node, possibly non-existent
        Returns:
        handler of events within the child node, or null
      • propertyAdded

        void propertyAdded​(PropertyState after)
        Notification for an added property
        Parameters:
        after - added property
      • propertyChanged

        void propertyChanged​(PropertyState before,
                             PropertyState after)
        Notification for a changed property
        Parameters:
        before - property before the change
        after - property after the change
      • propertyDeleted

        void propertyDeleted​(PropertyState before)
        Notification for a deleted property
        Parameters:
        before - deleted property
      • nodeAdded

        void nodeAdded​(java.lang.String name,
                       NodeState after)
        Notification for an added node
        Parameters:
        name - name of the node
        after - added node
      • nodeDeleted

        void nodeDeleted​(java.lang.String name,
                         NodeState before)
        Notification for a deleted node
        Parameters:
        name - name of the deleted node
        before - deleted node
      • nodeMoved

        void nodeMoved​(java.lang.String sourcePath,
                       java.lang.String name,
                       NodeState moved)
        Notification for a moved node
        Parameters:
        sourcePath - source of the moved node
        name - name of the moved node
        moved - moved node
      • nodeReordered

        void nodeReordered​(java.lang.String destName,
                           java.lang.String name,
                           NodeState reordered)
        Notification for a reordered node
        Parameters:
        destName - name of the orderBefore() destination node
        name - name of the moved node
        reordered - moved node