com.google.gxp.compiler.parser
Class ParsedElement

java.lang.Object
  extended by com.google.gxp.compiler.base.AbstractNode
      extended by com.google.gxp.compiler.parser.ParsedElement
All Implemented Interfaces:
Node
Direct Known Subclasses:
CallNamespace.CallElement, CppNamespace.CppElement, GxpNamespace.GxpElement, JavaNamespace.JavaElement, NullElement, OutputNamespace.ParsedOutputElement, TextElement

public abstract class ParsedElement
extends AbstractNode

Represents an XML element in the parse tree.


Constructor Summary
protected ParsedElement(SourcePosition sourcePosition, String displayName, List<ParsedAttribute> attrs, List<? extends ParsedElement> children)
           
 
Method Summary
abstract
<T> T
acceptVisitor(ParsedElementVisitor<T> visitor)
          Accepts the specified ParsedElementVisitor and returns the result of the visit.
 boolean canBeRoot()
          Indicates if the element is allowed to be the root element of a GXP document.
 List<ParsedAttribute> getAttributes()
           
 List<ParsedElement> getChildren()
           
 ParsedElement withChildren(List<ParsedElement> newChildren)
          This incomplete implementation checks to see if the chidren are the same as this ParsedElement's children, and if so returns this.
protected abstract  ParsedElement withChildrenImpl(List<ParsedElement> children)
          Underlying implementation for the slow path of the withChildren method.
 
Methods inherited from class com.google.gxp.compiler.base.AbstractNode
abstractNodeHashCode, equalsAbstractNode, getDisplayName, getSourcePosition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParsedElement

protected ParsedElement(SourcePosition sourcePosition,
                        String displayName,
                        List<ParsedAttribute> attrs,
                        List<? extends ParsedElement> children)
Method Detail

getAttributes

public List<ParsedAttribute> getAttributes()

getChildren

public List<ParsedElement> getChildren()

canBeRoot

public boolean canBeRoot()
Indicates if the element is allowed to be the root element of a GXP document.


acceptVisitor

public abstract <T> T acceptVisitor(ParsedElementVisitor<T> visitor)
Accepts the specified ParsedElementVisitor and returns the result of the visit.


withChildren

public final ParsedElement withChildren(List<ParsedElement> newChildren)

This incomplete implementation checks to see if the chidren are the same as this ParsedElement's children, and if so returns this. Otherwise it delegates to the withChildrenImpl method.


withChildrenImpl

protected abstract ParsedElement withChildrenImpl(List<ParsedElement> children)
Underlying implementation for the slow path of the withChildren method. Subclasses should override this so that it creates a new ParsedElement that's identical to themselves except for having the specified children.