org.apache.jackrabbit.util
Class ChildrenCollectorFilter
java.lang.Object
javax.jcr.util.TraversingItemVisitor
javax.jcr.util.TraversingItemVisitor.Default
org.apache.jackrabbit.util.ChildrenCollectorFilter
- All Implemented Interfaces:
- ItemVisitor
- public class ChildrenCollectorFilter
- extends TraversingItemVisitor.Default
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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ChildrenCollectorFilter
public ChildrenCollectorFilter(String namePattern,
Collection children,
boolean collectNodes,
boolean collectProperties,
int maxLevel)
- Constructs a
ChildrenCollectorFilter
- Parameters:
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
- umber of hierarchy levels to traverse
(e.g. 1 for direct children only, 2 for children and their children, and so on)
entering
protected void entering(Node node,
int level)
throws RepositoryException
-
- Throws:
RepositoryException
entering
protected void entering(Property property,
int level)
throws RepositoryException
-
- Throws:
RepositoryException
matches
public static boolean matches(String name,
String pattern)
- Matches the name pattern against the specified name.
The pattern may be a full name or a partial name with one or more
wildcard characters ("*"), or a disjunction (using the "|" character
to represent logical OR) of these. For example,
"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 *)
- Parameters:
name
- the name to test the pattern withpattern
- the pattern to be matched against the name
- Returns:
- true if the specified name matches the pattern
- See Also:
Node.getNodes(String)
Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.