org.apache.velocity.runtime.parser.node
Interface Node

All Superinterfaces:
Renderable
All Known Implementing Classes:
SimpleNode

public interface Node
extends Renderable

This file describes the interface between the Velocity code and the JavaCC generated code.

Version:
$Id: Node.java 737539 2009-01-25 17:24:29Z nbubna $
Author:
Henning P. Schmiedehausen

Method Summary
 Object childrenAccept(ParserVisitor visitor, Object data)
           
 boolean evaluate(InternalContextAdapter context)
           
 Object execute(Object o, InternalContextAdapter context)
           
 int getColumn()
           
 Token getFirstToken()
           
 int getInfo()
           
 Token getLastToken()
           
 int getLine()
           
 String getTemplateName()
           
 int getType()
           
 Object init(InternalContextAdapter context, Object data)
           
 boolean isInvalid()
           
 Object jjtAccept(ParserVisitor visitor, Object data)
           
 void jjtAddChild(Node n, int i)
          This method tells the node to add its argument to the node's list of children.
 void jjtClose()
          This method is called after all the child nodes have been added.
 Node jjtGetChild(int i)
          This method returns a child node.
 int jjtGetNumChildren()
          Return the number of children the node has.
 Node jjtGetParent()
           
 void jjtOpen()
          This method is called after the node has been made the current node.
 void jjtSetParent(Node n)
          This pair of methods are used to inform the node of its parent.
 String literal()
           
 boolean render(InternalContextAdapter context, Writer writer)
           
 void setInfo(int info)
           
 void setInvalid()
          Mark the node as invalid.
 Object value(InternalContextAdapter context)
           
 

Method Detail

jjtOpen

public void jjtOpen()
This method is called after the node has been made the current node. It indicates that child nodes can now be added to it.


jjtClose

public void jjtClose()
This method is called after all the child nodes have been added.


jjtSetParent

public void jjtSetParent(Node n)
This pair of methods are used to inform the node of its parent.

Parameters:
n -

jjtGetParent

public Node jjtGetParent()
Returns:
The node parent.

jjtAddChild

public void jjtAddChild(Node n,
                        int i)
This method tells the node to add its argument to the node's list of children.

Parameters:
n -
i -

jjtGetChild

public Node jjtGetChild(int i)
This method returns a child node. The children are numbered from zero, left to right.

Parameters:
i -
Returns:
A child node.

jjtGetNumChildren

public int jjtGetNumChildren()
Return the number of children the node has.

Returns:
The number of children of this node.

jjtAccept

public Object jjtAccept(ParserVisitor visitor,
                        Object data)
Parameters:
visitor -
data -
Returns:
The Node execution result object.

childrenAccept

public Object childrenAccept(ParserVisitor visitor,
                             Object data)
Parameters:
visitor -
data -
Returns:
The node execution result.
See Also:
jjtAccept(ParserVisitor, Object)

getFirstToken

public Token getFirstToken()
Returns:
The first token.

getLastToken

public Token getLastToken()
Returns:
The last token.

getType

public int getType()
Returns:
The NodeType.

init

public Object init(InternalContextAdapter context,
                   Object data)
            throws TemplateInitException
Parameters:
context -
data -
Returns:
The init result.
Throws:
TemplateInitException

evaluate

public boolean evaluate(InternalContextAdapter context)
                 throws MethodInvocationException
Parameters:
context -
Returns:
The evaluation result.
Throws:
MethodInvocationException

value

public Object value(InternalContextAdapter context)
             throws MethodInvocationException
Parameters:
context -
Returns:
The node value.
Throws:
MethodInvocationException

render

public boolean render(InternalContextAdapter context,
                      Writer writer)
               throws IOException,
                      MethodInvocationException,
                      ParseErrorException,
                      ResourceNotFoundException
Specified by:
render in interface Renderable
Parameters:
context -
writer -
Returns:
True if the node rendered successfully.
Throws:
IOException
MethodInvocationException
ParseErrorException
ResourceNotFoundException

execute

public Object execute(Object o,
                      InternalContextAdapter context)
               throws MethodInvocationException
Parameters:
o -
context -
Returns:
The execution result.
Throws:
MethodInvocationException

setInfo

public void setInfo(int info)
Parameters:
info -

getInfo

public int getInfo()
Returns:
The current node info.

literal

public String literal()
Returns:
A literal.

setInvalid

public void setInvalid()
Mark the node as invalid.


isInvalid

public boolean isInvalid()
Returns:
True if the node is invalid.

getLine

public int getLine()
Returns:
The current line position.

getColumn

public int getColumn()
Returns:
The current column position.

getTemplateName

public String getTemplateName()
Returns:
the file name of the template


Copyright © 2000-2010 Apache Software Foundation. All Rights Reserved.