|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gdata.model.CompositeElementVisitor
public class CompositeElementVisitor
This class provides an ElementVisitor implementation that aggregates multiple nested ElementVisitor instances. This makes it possible to apply several different unrelated visitor implementations during a single data model tree traversal.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.google.gdata.model.ElementVisitor |
---|
ElementVisitor.StoppedException |
Constructor Summary | |
---|---|
CompositeElementVisitor(ElementVisitor... visitors)
Constructs a new CompositeElementVisitor instance containing the array of visitor instances passed in. |
Method Summary | |
---|---|
void |
addVisitor(ElementVisitor visitor)
Adds a new ElementVisitor instance to the composite visitor. |
ElementVisitor.StoppedException |
getStoppedException(ElementVisitor visitor)
Returns any StoppedException thrown by the specified visitor, or null if the visitor completed normally. |
java.util.List<ElementVisitor> |
getVisitors()
Returns the list of active element visitor instances. |
boolean |
visit(Element parent,
Element target,
ElementMetadata<?,?> metadata)
Called during Element tree traversal to allow the visitor instance to process an element in the tree. |
void |
visitComplete(Element parent,
Element target,
ElementMetadata<?,?> metadata)
The visitComplete method is called when traversal for an Element and all of its nested children has been completed. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CompositeElementVisitor(ElementVisitor... visitors)
visitors
- list of ElementVisitor instances to compose.Method Detail |
---|
public void addVisitor(ElementVisitor visitor)
ElementVisitor
instance to the composite visitor. For
any element, events will be delivered to the added visitor after events
have been delivered to other visitors already contained in the composite
visitor at the time of addition.
visitor
- the new visitor to add.public java.util.List<ElementVisitor> getVisitors()
public ElementVisitor.StoppedException getStoppedException(ElementVisitor visitor)
null
if the visitor completed normally.
public boolean visit(Element parent, Element target, ElementMetadata<?,?> metadata) throws ElementVisitor.StoppedException
ElementVisitor
visit
in interface ElementVisitor
parent
- the parent of the target elementtarget
- the target element being visitedmetadata
- the metadata for the target element
ElementVisitor.StoppedException
- if the data model traversal should be stopped
immediately. This may be the result of an unexpected error, or some
visitor implementations may extend this exception type to signal
specific exit conditions.public void visitComplete(Element parent, Element target, ElementMetadata<?,?> metadata) throws ElementVisitor.StoppedException
ElementVisitor
visitComplete
in interface ElementVisitor
parent
- the parent of the target elementtarget
- the visited elementmetadata
- the metadata for the target element
ElementVisitor.StoppedException
- if the data model traversal should be stopped
immediately. This may be the result of an unexpected error, or some
visitor implementations may extend this exception type to signal
specific exit conditions.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |