Package 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 theItemVisitor
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
Constructors Constructor Description ChildrenCollectorFilter(String[] nameGlobs, Collection<Item> children, boolean collectNodes, boolean collectProperties, int maxLevel)
Constructs aChildrenCollectorFilter
ChildrenCollectorFilter(String namePattern, Collection<Item> children, boolean collectNodes, boolean collectProperties, int maxLevel)
Constructs aChildrenCollectorFilter
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)
static boolean
matches(String name, String[] nameGlobs)
-
Methods inherited from class javax.jcr.util.TraversingItemVisitor.Default
leaving, leaving
-
Methods inherited from class javax.jcr.util.TraversingItemVisitor
visit, visit
-
-
-
-
Constructor Detail
-
ChildrenCollectorFilter
public ChildrenCollectorFilter(String namePattern, Collection<Item> children, boolean collectNodes, boolean collectProperties, int maxLevel)
Constructs aChildrenCollectorFilter
- 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
- number of hierarchy levels to traverse (e.g. 1 for direct children only, 2 for children and their children, and so on)
-
ChildrenCollectorFilter
public ChildrenCollectorFilter(String[] nameGlobs, Collection<Item> children, boolean collectNodes, boolean collectProperties, int maxLevel)
Constructs aChildrenCollectorFilter
- Parameters:
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
-
collectChildNodes
public static NodeIterator collectChildNodes(Node node, String namePattern) throws RepositoryException
- Throws:
RepositoryException
-
collectChildNodes
public static NodeIterator collectChildNodes(Node node, String[] nameGlobs) throws RepositoryException
- Throws:
RepositoryException
-
collectProperties
public static PropertyIterator collectProperties(Node node, String namePattern) throws RepositoryException
- Throws:
RepositoryException
-
collectProperties
public static PropertyIterator collectProperties(Node node, String[] nameGlobs) throws RepositoryException
- Throws:
RepositoryException
-
entering
protected void entering(Node node, int level) throws RepositoryException
- Overrides:
entering
in classTraversingItemVisitor.Default
- Throws:
RepositoryException
-
entering
protected void entering(Property property, int level) throws RepositoryException
- Overrides:
entering
in classTraversingItemVisitor.Default
- Throws:
RepositoryException
-
matches
public static boolean matches(String name, String pattern)
- See Also:
Node.getNodes(String)
-
matches
public static boolean matches(String name, String[] nameGlobs)
- See Also:
Node.getNodes(String)
-
-