com.google.gdata.model
Interface ElementVisitor

All Known Implementing Classes:
CompositeElementVisitor, XmlGenerator

public interface ElementVisitor

The ElementVisitor interface describes the implementation of a visitor pattern for GData data model processing.

See Also:
Element.visit(ElementVisitor, ElementMetadata)

Nested Class Summary
static class ElementVisitor.StoppedException
          The StoppedException is thrown by ElementVisitor instances to immediately exit from element tree processing.
 
Method Summary
 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.
 

Method Detail

visit

boolean visit(Element parent,
              Element target,
              ElementMetadata<?,?> metadata)
              throws ElementVisitor.StoppedException
Called during Element tree traversal to allow the visitor instance to process an element in the tree.

Parameters:
parent - the parent of the target element
target - the target element being visited
metadata - the metadata for the target element
Returns:
boolean value indicating whether child elements (if any) should be visited.
Throws:
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.

visitComplete

void visitComplete(Element parent,
                   Element target,
                   ElementMetadata<?,?> metadata)
                   throws ElementVisitor.StoppedException
The visitComplete method is called when traversal for an Element and all of its nested children has been completed.

Parameters:
parent - the parent of the target element
target - the visited element
metadata - the metadata for the target element
Throws:
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.