public class UniversalFilter extends java.lang.Object implements EventFilter
Filter
implementation, which can be parametrised by
a UniversalFilter.Selector
and a Predicate
. The selector maps a call back
on this filter to a NodeState
. That node state is in turn passed
to the predicate for determining whether to include or to exclude the
respective event.Modifier and Type | Class and Description |
---|---|
static interface |
UniversalFilter.Selector
A selector instance maps call backs on
Filters to NodeState instances,
which should be used for determining inclusion or exclusion of the associated event. |
Constructor and Description |
---|
UniversalFilter(@NotNull NodeState before,
@NotNull NodeState after,
@NotNull UniversalFilter.Selector selector,
@NotNull com.google.common.base.Predicate<NodeState> predicate)
Create a new instance of an universal filter rooted at the passed trees.
|
Modifier and Type | Method and Description |
---|---|
EventFilter |
create(java.lang.String name,
NodeState before,
NodeState after)
Factory for creating a filter instance for the given child node
|
@NotNull NodeState |
getAfterState() |
@NotNull NodeState |
getBeforeState() |
boolean |
includeAdd(PropertyState after)
Include an added property
|
boolean |
includeAdd(java.lang.String name,
NodeState after)
Include an added node
|
boolean |
includeChange(PropertyState before,
PropertyState after)
Include a changed property
|
boolean |
includeDelete(PropertyState before)
Include a deleted property
|
boolean |
includeDelete(java.lang.String name,
NodeState before)
Include a deleted node
|
boolean |
includeMove(java.lang.String sourcePath,
java.lang.String name,
NodeState moved)
Include a moved node
|
boolean |
includeReorder(java.lang.String destName,
java.lang.String name,
NodeState reordered)
Include a reordered node
|
public UniversalFilter(@NotNull @NotNull NodeState before, @NotNull @NotNull NodeState after, @NotNull @NotNull UniversalFilter.Selector selector, @NotNull @NotNull com.google.common.base.Predicate<NodeState> predicate)
before
- before stateafter
- after stateselector
- selector for selecting the tree to match the predicate againstpredicate
- predicate for determining whether to include or to exclude an event@NotNull public @NotNull NodeState getBeforeState()
@NotNull public @NotNull NodeState getAfterState()
public boolean includeAdd(PropertyState after)
EventFilter
includeAdd
in interface EventFilter
after
- added propertytrue
if the property should be includedpublic boolean includeChange(PropertyState before, PropertyState after)
EventFilter
includeChange
in interface EventFilter
before
- property before the changeafter
- property after the changetrue
if the property should be includedpublic boolean includeDelete(PropertyState before)
EventFilter
includeDelete
in interface EventFilter
before
- deleted propertytrue
if the property should be includedpublic boolean includeAdd(java.lang.String name, NodeState after)
EventFilter
includeAdd
in interface EventFilter
name
- name of the nodeafter
- added nodetrue
if the node should be includedpublic boolean includeDelete(java.lang.String name, NodeState before)
EventFilter
includeDelete
in interface EventFilter
name
- name of the nodebefore
- deleted nodetrue
if the node should be includedpublic boolean includeMove(java.lang.String sourcePath, java.lang.String name, NodeState moved)
EventFilter
includeMove
in interface EventFilter
sourcePath
- source path of the move operationname
- name of the moved nodemoved
- the moved nodetrue
if the node should be includedpublic boolean includeReorder(java.lang.String destName, java.lang.String name, NodeState reordered)
EventFilter
includeReorder
in interface EventFilter
destName
- name of the orderBefore()
destination nodename
- name of the reordered nodereordered
- the reordered nodetrue
if the node should be includedpublic EventFilter create(java.lang.String name, NodeState before, NodeState after)
EventFilter
create
in interface EventFilter
name
- name of the child nodebefore
- before state of the child nodeafter
- after state of the child nodenull
to
exclude the sub tree rooted at this child node.Copyright © 2010 - 2020 Adobe. All Rights Reserved