|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.jcr.util.TraversingItemVisitor
javax.jcr.util.TraversingItemVisitor.Default
org.apache.jackrabbit.util.ChildrenCollectorFilter
public class ChildrenCollectorFilter
ChildrenCollectorFilter
is a utility class
which can be used to 'collect' child items of a
node whose names match a certain pattern. It implements the
ItemVisitor
interface.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.jcr.util.TraversingItemVisitor |
---|
TraversingItemVisitor.Default |
Field Summary |
---|
Fields inherited from class javax.jcr.util.TraversingItemVisitor |
---|
breadthFirst, maxLevel |
Constructor Summary | |
---|---|
ChildrenCollectorFilter(String[] nameGlobs,
Collection<Item> children,
boolean collectNodes,
boolean collectProperties,
int maxLevel)
Constructs a ChildrenCollectorFilter |
|
ChildrenCollectorFilter(String namePattern,
Collection<Item> children,
boolean collectNodes,
boolean collectProperties,
int maxLevel)
Constructs a ChildrenCollectorFilter |
Method Summary | |
---|---|
static NodeIterator |
collectChildNodes(Node node,
String namePattern)
|
static NodeIterator |
collectChildNodes(Node node,
String[] nameGlobs)
|
static PropertyIterator |
collectProperties(Node node,
String namePattern)
|
static PropertyIterator |
collectProperties(Node node,
String[] nameGlobs)
|
protected void |
entering(Node node,
int level)
|
protected void |
entering(Property property,
int level)
|
static boolean |
matches(String name,
String pattern)
Matches the name pattern against the specified name. |
static boolean |
matches(String name,
String[] nameGlobs)
Matches the nameGlob strings in the passed array against
the specified name. |
Methods inherited from class javax.jcr.util.TraversingItemVisitor.Default |
---|
leaving, leaving |
Methods inherited from class javax.jcr.util.TraversingItemVisitor |
---|
visit, visit |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ChildrenCollectorFilter(String namePattern, Collection<Item> children, boolean collectNodes, boolean collectProperties, int maxLevel)
ChildrenCollectorFilter
namePattern
- the pattern which should be applied to the names
of the childrenchildren
- where the matching children should be addedcollectNodes
- true, if child nodes should be collected; otherwise falsecollectProperties
- true, if child properties should be collected; otherwise falsemaxLevel
- number of hierarchy levels to traverse
(e.g. 1 for direct children only, 2 for children and their children, and so on)public ChildrenCollectorFilter(String[] nameGlobs, Collection<Item> children, boolean collectNodes, boolean collectProperties, int maxLevel)
ChildrenCollectorFilter
nameGlobs
- an array of globbing strings which should be
applied to the names of the childrenchildren
- where the matching children should be addedcollectNodes
- true, if child nodes should be collected; otherwise falsecollectProperties
- true, if child properties should be collected; otherwise falsemaxLevel
- number of hierarchy levels to traverse
(e.g. 1 for direct children only, 2 for children and their children, and so on)Method Detail |
---|
public static NodeIterator collectChildNodes(Node node, String namePattern) throws RepositoryException
RepositoryException
public static NodeIterator collectChildNodes(Node node, String[] nameGlobs) throws RepositoryException
RepositoryException
public static PropertyIterator collectProperties(Node node, String namePattern) throws RepositoryException
RepositoryException
public static PropertyIterator collectProperties(Node node, String[] nameGlobs) throws RepositoryException
RepositoryException
protected void entering(Node node, int level) throws RepositoryException
entering
in class TraversingItemVisitor.Default
RepositoryException
protected void entering(Property property, int level) throws RepositoryException
entering
in class TraversingItemVisitor.Default
RepositoryException
public static boolean matches(String name, String pattern)
"jcr:*|foo:bar"
would match
"foo:bar"
, but also "jcr:whatever"
.
The EBNF for pattern is: namePattern ::= disjunct {'|' disjunct} disjunct ::= name [':' name] name ::= '*' | ['*'] fragment {'*' fragment}['*'] fragment ::= char {char} char ::= nonspace | ' ' nonspace ::= (* Any Unicode character except: '/', ':', '[', ']', '*', ''', '"', '|' or any whitespace character *)Note that leading and trailing whitespace around a pattern is ignored.
name
- the name to test the pattern withpattern
- the pattern to be matched against the name
Node.getNodes(String)
public static boolean matches(String name, String[] nameGlobs)
nameGlob
strings in the passed array against
the specified name.
A glob may be a full name or a partial name with one or more
wildcard characters ("*
").
Note that unlike in the case of the matches(String, String)
leading and trailing whitespace around a glob is not ignored.
name
- the name to test the pattern withnameGlobs
- an array of globbing strings
Node.getNodes(String[])
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |