Class SimpleNode
- java.lang.Object
-
- org.apache.velocity.runtime.parser.node.SimpleNode
-
- All Implemented Interfaces:
Node,Renderable
- Direct Known Subclasses:
ASTAndNode,ASTAssignment,ASTBlock,ASTComment,ASTDirective,ASTElseIfStatement,ASTElseStatement,ASTEQNode,ASTEscape,ASTEscapedDirective,ASTExpression,ASTFalse,ASTFloatingPointLiteral,ASTGENode,ASTGTNode,ASTIdentifier,ASTIfStatement,ASTIncludeStatement,ASTIndex,ASTIntegerLiteral,ASTIntegerRange,ASTLENode,ASTLTNode,ASTMap,ASTMathNode,ASTMethod,ASTNENode,ASTNotNode,ASTObjectArray,ASTOrNode,ASTParameters,ASTprocess,ASTReference,ASTSetDirective,ASTStringLiteral,ASTText,ASTTextblock,ASTTrue,ASTVariable,ASTWord
public class SimpleNode extends java.lang.Object implements Node
-
-
Field Summary
Fields Modifier and Type Field Description protected Node[]childrenprotected Tokenfirstprotected intidprotected intinfoprotected booleaninvalidprotected Tokenlastprotected Loglogprotected Nodeparentprotected Parserparserprotected RuntimeServicesrsvcbooleanstateprotected java.lang.StringtemplateName
-
Constructor Summary
Constructors Constructor Description SimpleNode(int i)SimpleNode(Parser p, int i)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectchildrenAccept(ParserVisitor visitor, java.lang.Object data)voiddump(java.lang.String prefix)Override this method if you want to customize how the node dumps out its children.booleanevaluate(InternalContextAdapter context)java.lang.Objectexecute(java.lang.Object o, InternalContextAdapter context)intgetColumn()TokengetFirstToken()intgetInfo()TokengetLastToken()intgetLine()protected java.lang.StringgetLocation(InternalContextAdapter context)Return a string that tells the current location of this node.RuntimeServicesgetRuntimeServices()java.lang.StringgetTemplateName()intgetType()java.lang.Objectinit(InternalContextAdapter context, java.lang.Object data)booleanisInvalid()java.lang.ObjectjjtAccept(ParserVisitor visitor, java.lang.Object data)voidjjtAddChild(Node n, int i)This method tells the node to add its argument to the node's list of children.voidjjtClose()This method is called after all the child nodes have been added.NodejjtGetChild(int i)This method returns a child node.intjjtGetNumChildren()Return the number of children the node has.NodejjtGetParent()voidjjtOpen()This method is called after the node has been made the current node.voidjjtSetParent(Node n)This pair of methods are used to inform the node of its parent.java.lang.Stringliteral()booleanrender(InternalContextAdapter context, java.io.Writer writer)voidsetFirstToken(Token t)voidsetInfo(int info)voidsetInvalid()Mark the node as invalid.java.lang.StringtoString()java.lang.StringtoString(java.lang.String prefix)java.lang.Objectvalue(InternalContextAdapter context)
-
-
-
Field Detail
-
rsvc
protected RuntimeServices rsvc
-
log
protected Log log
-
parent
protected Node parent
-
children
protected Node[] children
-
id
protected int id
-
parser
protected Parser parser
-
info
protected int info
-
state
public boolean state
-
invalid
protected boolean invalid
-
first
protected Token first
-
last
protected Token last
-
templateName
protected java.lang.String templateName
-
-
Constructor Detail
-
SimpleNode
public SimpleNode(int i)
- Parameters:
i-
-
SimpleNode
public SimpleNode(Parser p, int i)
- Parameters:
p-i-
-
-
Method Detail
-
getRuntimeServices
public RuntimeServices getRuntimeServices()
-
jjtOpen
public void jjtOpen()
Description copied from interface:NodeThis method is called after the node has been made the current node. It indicates that child nodes can now be added to it.- Specified by:
jjtOpenin interfaceNode- See Also:
Node.jjtOpen()
-
jjtClose
public void jjtClose()
Description copied from interface:NodeThis method is called after all the child nodes have been added.- Specified by:
jjtClosein interfaceNode- See Also:
Node.jjtClose()
-
setFirstToken
public void setFirstToken(Token t)
- Parameters:
t-
-
getFirstToken
public Token getFirstToken()
- Specified by:
getFirstTokenin interfaceNode- Returns:
- The first token.
- See Also:
Node.getFirstToken()
-
getLastToken
public Token getLastToken()
- Specified by:
getLastTokenin interfaceNode- Returns:
- The last token.
- See Also:
Node.getLastToken()
-
jjtSetParent
public void jjtSetParent(Node n)
Description copied from interface:NodeThis pair of methods are used to inform the node of its parent.- Specified by:
jjtSetParentin interfaceNode- See Also:
Node.jjtSetParent(org.apache.velocity.runtime.parser.node.Node)
-
jjtGetParent
public Node jjtGetParent()
- Specified by:
jjtGetParentin interfaceNode- Returns:
- The node parent.
- See Also:
Node.jjtGetParent()
-
jjtAddChild
public void jjtAddChild(Node n, int i)
Description copied from interface:NodeThis method tells the node to add its argument to the node's list of children.- Specified by:
jjtAddChildin interfaceNode- See Also:
Node.jjtAddChild(org.apache.velocity.runtime.parser.node.Node, int)
-
jjtGetChild
public Node jjtGetChild(int i)
Description copied from interface:NodeThis method returns a child node. The children are numbered from zero, left to right.- Specified by:
jjtGetChildin interfaceNode- Returns:
- A child node.
- See Also:
Node.jjtGetChild(int)
-
jjtGetNumChildren
public int jjtGetNumChildren()
Description copied from interface:NodeReturn the number of children the node has.- Specified by:
jjtGetNumChildrenin interfaceNode- Returns:
- The number of children of this node.
- See Also:
Node.jjtGetNumChildren()
-
jjtAccept
public java.lang.Object jjtAccept(ParserVisitor visitor, java.lang.Object data)
- Specified by:
jjtAcceptin interfaceNode- Returns:
- The Node execution result object.
- See Also:
Node.jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object)
-
childrenAccept
public java.lang.Object childrenAccept(ParserVisitor visitor, java.lang.Object data)
- Specified by:
childrenAcceptin interfaceNode- Returns:
- The node execution result.
- See Also:
Node.childrenAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object)
-
toString
public java.lang.String toString(java.lang.String prefix)
- Parameters:
prefix-- Returns:
- String representation of this node.
-
dump
public void dump(java.lang.String prefix)
Override this method if you want to customize how the node dumps out its children.- Parameters:
prefix-
-
getLocation
protected java.lang.String getLocation(InternalContextAdapter context)
Return a string that tells the current location of this node.
-
literal
public java.lang.String literal()
- Specified by:
literalin interfaceNode- Returns:
- A literal.
- See Also:
Node.literal()
-
init
public java.lang.Object init(InternalContextAdapter context, java.lang.Object data) throws TemplateInitException
- Specified by:
initin interfaceNode- Returns:
- The init result.
- Throws:
TemplateInitException- See Also:
Node.init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)
-
evaluate
public boolean evaluate(InternalContextAdapter context) throws MethodInvocationException
- Specified by:
evaluatein interfaceNode- Returns:
- The evaluation result.
- Throws:
MethodInvocationException- See Also:
Node.evaluate(org.apache.velocity.context.InternalContextAdapter)
-
value
public java.lang.Object value(InternalContextAdapter context) throws MethodInvocationException
- Specified by:
valuein interfaceNode- Returns:
- The node value.
- Throws:
MethodInvocationException- See Also:
Node.value(org.apache.velocity.context.InternalContextAdapter)
-
render
public boolean render(InternalContextAdapter context, java.io.Writer writer) throws java.io.IOException, MethodInvocationException, ParseErrorException, ResourceNotFoundException
- Specified by:
renderin interfaceNode- Specified by:
renderin interfaceRenderable- Returns:
- True if the node rendered successfully.
- Throws:
java.io.IOExceptionMethodInvocationExceptionParseErrorExceptionResourceNotFoundException- See Also:
Node.render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer)
-
execute
public java.lang.Object execute(java.lang.Object o, InternalContextAdapter context) throws MethodInvocationException- Specified by:
executein interfaceNode- Returns:
- The execution result.
- Throws:
MethodInvocationException- See Also:
Node.execute(java.lang.Object, org.apache.velocity.context.InternalContextAdapter)
-
getType
public int getType()
- Specified by:
getTypein interfaceNode- Returns:
- The NodeType.
- See Also:
Node.getType()
-
setInfo
public void setInfo(int info)
- Specified by:
setInfoin interfaceNode- See Also:
Node.setInfo(int)
-
getInfo
public int getInfo()
- Specified by:
getInfoin interfaceNode- Returns:
- The current node info.
- See Also:
Node.getInfo()
-
setInvalid
public void setInvalid()
Description copied from interface:NodeMark the node as invalid.- Specified by:
setInvalidin interfaceNode- See Also:
Node.setInvalid()
-
isInvalid
public boolean isInvalid()
- Specified by:
isInvalidin interfaceNode- Returns:
- True if the node is invalid.
- See Also:
Node.isInvalid()
-
getLine
public int getLine()
- Specified by:
getLinein interfaceNode- Returns:
- The current line position.
- See Also:
Node.getLine()
-
getColumn
public int getColumn()
- Specified by:
getColumnin interfaceNode- Returns:
- The current column position.
- See Also:
Node.getColumn()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Since:
- 1.5
-
getTemplateName
public java.lang.String getTemplateName()
- Specified by:
getTemplateNamein interfaceNode- Returns:
- the file name of the template
-
-