org.richfaces.cdk.templatecompiler.el.node
Class AbstractTreeNode

java.lang.Object
  extended by org.richfaces.cdk.templatecompiler.el.node.AbstractTreeNode
All Implemented Interfaces:
ITreeNode
Direct Known Subclasses:
AbstractBinaryOperationTreeNode, AbstractMethodTreeNode, AstBracketSuffixTreeNode, AstChoiceTreeNode, AstDeferredOrDynamicExpressionTreeNode, AstEmptyTreeNode, AstFloatingPointTreeNode, AstIdentifierTreeNode, AstIntegerTreeNode, AstLiteralTreeNode, AstNegativeTreeNode, AstNotTreeNode, AstPropertySuffixTreeNode, AstStringTreeNode, AstValueTreeNode, ConstantValueTreeNode, EqualityTestTreeNode

public abstract class AbstractTreeNode
extends java.lang.Object
implements ITreeNode

This abstract class implement some methods of ITreeNode interface to using in subclasses.

Author:
amarkhel

Constructor Summary
AbstractTreeNode(org.jboss.el.parser.Node node)
           
 
Method Summary
protected  java.lang.String coerceToBoolean(java.lang.String value, ELVisitor visitor)
           
 ITreeNode getChild(int index, ELVisitor visitor)
          Visit current node.
protected  java.lang.String getChildOutput(int childIndex, ELVisitor visitor)
          Collects output from visiting child of the current node with the specified index and returns collected string.
 int getChildrenCount()
          Returns count of children for this node
 org.jboss.el.parser.Node getNode()
          Return node of current wrapper.
abstract  void visit(java.lang.StringBuilder sb, ELVisitor visitor)
          Return child of wrapped node by specified index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTreeNode

public AbstractTreeNode(org.jboss.el.parser.Node node)
Method Detail

getChildOutput

protected java.lang.String getChildOutput(int childIndex,
                                          ELVisitor visitor)
                                   throws ParsingException
Collects output from visiting child of the current node with the specified index and returns collected string.

Parameters:
childIndex -
context -
visitor -
Returns:
Throws:
ParsingException

coerceToBoolean

protected java.lang.String coerceToBoolean(java.lang.String value,
                                           ELVisitor visitor)

getNode

public org.jboss.el.parser.Node getNode()
Return node of current wrapper.

Specified by:
getNode in interface ITreeNode
Returns:
instance of org.jboss.el.parser.Node

getChild

public ITreeNode getChild(int index,
                          ELVisitor visitor)
                   throws ParsingException
Visit current node. Generate Java code, that represent current node.

Specified by:
getChild in interface ITreeNode
Parameters:
stringBuilder - instance to collect information.
context - - context to resolve beans
visitor - - ELVisitor
Returns:
instance of org.jboss.el.parser.Node
Throws:
ParsingException - - if error occurred during parsing process.

getChildrenCount

public int getChildrenCount()
Returns count of children for this node

Specified by:
getChildrenCount in interface ITreeNode
Returns:
children count

visit

public abstract void visit(java.lang.StringBuilder sb,
                           ELVisitor visitor)
                    throws ParsingException
Return child of wrapped node by specified index. Abstract operation to override in subclasses.

Specified by:
visit in interface ITreeNode
Parameters:
index - - index of child.
Throws:
ParsingException - - if error occurred(child not found).


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.