|
Oracle® Database XML Java API Reference 11g Release 2 (11.2) E10769-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
javax.jcr.util.TraversingItemVisitor
public abstract class TraversingItemVisitor
An implementation of ItemVisitor
. <p/> TraversingItemVisitor
is an abstract utility class which allows to easily traverse an Item
hierarchy. <p/>
TraversingItemVisitor
makes use of the Visitor Pattern as described in the book 'Design Patterns' by the Gang Of Four (Gamma et al.). <p/>
Tree traversal is done observing the left-to-right order of child Item
s if such an order is supported and exists.
Nested Class Summary | |
---|---|
static class |
TraversingItemVisitor.Default Convenience class providing default implementations of the abstract methods of TraversingItemVisitor . |
Field Summary | |
---|---|
protected boolean |
breadthFirst indicates if traversal should be done in a breadth-first manner rather than depth-first (which is the default) |
protected int |
maxLevel the 0-based level up to which the hierarchy should be traversed (if it's -1, the hierarchy will be traversed until there are no more children of the current item) |
Constructor Summary | |
---|---|
TraversingItemVisitor() Constructs a new instance of this class. |
|
TraversingItemVisitor(boolean breadthFirst) Constructs a new instance of this class. |
|
TraversingItemVisitor(boolean breadthFirst, int maxLevel) Constructs a new instance of this class. |
Method Summary | |
---|---|
protected abstract void |
entering(Node node, int level) Implement this method to add behaviour performed before a Node is visited. |
protected abstract void |
entering(Property property, int level) Implement this method to add behaviour performed before a Property is visited. |
protected abstract void |
leaving(Node node, int level) Implement this method to add behaviour performed after a Node is visited. |
protected abstract void |
leaving(Property property, int level) Implement this method to add behaviour performed after a Property is visited. |
void |
visit(Node node) Called when the Visitor is passed to a Node . |
void |
visit(Property property) Called when the Visitor is passed to a Property . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final boolean breadthFirst
protected final int maxLevel
Constructor Detail |
---|
public TraversingItemVisitor()
Item
s will be traversed in a depth-first manner (default behaviour).public TraversingItemVisitor(boolean breadthFirst)
breadthFirst
- if breadthFirst
is true then traversal is done in a breadth-first manner; otherwise it is done in a depth-first manner (which is the default behaviour).public TraversingItemVisitor(boolean breadthFirst, int maxLevel)
breadthFirst
- if breadthFirst
is true then traversal is done in a breadth-first manner; otherwise it is done in a depth-first manner (which is the default behaviour).maxLevel
- the 0-based level up to which the hierarchy should be traversed (if it's -1, the hierarchy will be traversed until there are no more children of the current item)Method Detail |
---|
protected abstract void entering(Property property, int level) throws RepositoryException
Property
is visited.property
- the Property
that is accepting this visitor.level
- hierarchy level of this property (the root node starts at level 0)RepositoryException
- if an error occurrsprotected abstract void entering(Node node, int level) throws RepositoryException
Node
is visited.node
- the Node
that is accepting this visitor.level
- hierarchy level of this node (the root node starts at level 0)RepositoryException
- if an error occurrsprotected abstract void leaving(Property property, int level) throws RepositoryException
Property
is visited.property
- the Property
that is accepting this visitor.level
- hierarchy level of this property (the root node starts at level 0)RepositoryException
- if an error occurrsprotected abstract void leaving(Node node, int level) throws RepositoryException
Node
is visited.node
- the Node
that is accepting this visitor.level
- hierarchy level of this node (the root node starts at level 0)RepositoryException
- if an error occurrspublic void visit(Property property) throws RepositoryException
Property
. <p/> It calls TraversingItemVisitor.entering(Property, int)
followed by TraversingItemVisitor.leaving(Property, int)
. Implement these abstract methods to specify behaviour on 'arrival at' and 'after leaving' the Property
. <p/> <p/> If this method throws, the visiting process is aborted.visit
in interface ItemVisitor
property
- the Property
that is accepting this visitor.RepositoryException
- if an error occurrspublic void visit(Node node) throws RepositoryException
Node
. <p/> It calls TraversingItemVisitor.entering(Node, int)
followed by TraversingItemVisitor.leaving(Node, int)
. Implement these abstract methods to specify behaviour on 'arrival at' and 'after leaving' the Node
. <p/> If this method throws, the visiting process is aborted.visit
in interface ItemVisitor
node
- the Node
that is accepting this visitor.RepositoryException
- if an error occurrs
|
Oracle® Database XML Java API Reference 11g Release 2 (11.2) E10769-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |