public class GlobbingPathFilter extends java.lang.Object implements EventFilter
Filter
implementation supports filtering on paths using
simple glob patterns. Such a pattern is a string denoting a path. Each
element of the pattern is matched against the corresponding element of
a path. Elements of the pattern are matched literally except for the special
elements *
and **
where the former matches an arbitrary
path element and the latter matches any number of path elements (including none).
Note: an empty path pattern matches no path.
Note: path patterns only match against the corresponding elements of the path and do not distinguish between absolute and relative paths.
Note: there is no way to escape *
and **
.
Examples:
q matches q only * matches character matches zero or more characters of a name component without crossing path boundaries (ie without crossing /) ** matches every path a/b/c matches a/b/c only a/*/c matches a/x/c for every element x a/*.html/c matches a/x.html/c for every character sequence x (that doesn't include /) a/*.*/c matches a/x.y/c for every character sequence x and y (that don't include /) **/y/z match every path ending in y/z r/s/t/** matches r/s/t and all its descendants
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
STAR |
static java.lang.String |
STAR_STAR |
Constructor and Description |
---|
GlobbingPathFilter(@NotNull java.lang.String pattern)
for testing only - use variant which passes the patternMap for productive code
|
GlobbingPathFilter(@NotNull java.lang.String pattern,
java.util.Map<java.lang.String,java.util.regex.Pattern> patternMap) |
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
|
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
|
java.lang.String |
toString() |
public static final java.lang.String STAR
public static final java.lang.String STAR_STAR
public GlobbingPathFilter(@NotNull @NotNull java.lang.String pattern, java.util.Map<java.lang.String,java.util.regex.Pattern> patternMap)
public GlobbingPathFilter(@NotNull @NotNull java.lang.String pattern)
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.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2010 - 2020 Adobe. All Rights Reserved