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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
enter(NodeState before, NodeState after)
Called before the given before and after states are compared.@Nullable EventHandler
getChildHandler(java.lang.String name, NodeState before, NodeState after)
Returns a handler of events within the given child node, ornull
if changes within that child are not to be processed.void
leave(NodeState before, NodeState after)
Called after the given before and after states are compared.void
nodeAdded(java.lang.String name, NodeState after)
Notification for an added nodevoid
nodeDeleted(java.lang.String name, NodeState before)
Notification for a deleted nodevoid
nodeMoved(java.lang.String sourcePath, java.lang.String name, NodeState moved)
Notification for a moved nodevoid
nodeReordered(java.lang.String destName, java.lang.String name, NodeState reordered)
Notification for a reordered nodevoid
propertyAdded(PropertyState after)
Notification for an added propertyvoid
propertyChanged(PropertyState before, PropertyState after)
Notification for a changed propertyvoid
propertyDeleted(PropertyState before)
Notification for a deleted property
-
-
-
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 addedafter
- 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 addedafter
- 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, ornull
if changes within that child are not to be processed.- Parameters:
name
- name of the child nodebefore
- before state of the child node, possibly non-existentafter
- 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 changeafter
- 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 nodeafter
- added node
-
nodeDeleted
void nodeDeleted(java.lang.String name, NodeState before)
Notification for a deleted node- Parameters:
name
- name of the deleted nodebefore
- 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 nodename
- name of the moved nodemoved
- moved node
-
nodeReordered
void nodeReordered(java.lang.String destName, java.lang.String name, NodeState reordered)
Notification for a reordered node- Parameters:
destName
- name of theorderBefore()
destination nodename
- name of the moved nodereordered
- moved node
-
-