org.apache.velocity.runtime.parser.node
Class ASTMethod

java.lang.Object
  extended by org.apache.velocity.runtime.parser.node.SimpleNode
      extended by org.apache.velocity.runtime.parser.node.ASTMethod
All Implemented Interfaces:
Node, Renderable

public class ASTMethod
extends SimpleNode

ASTMethod.java Method support for references : $foo.method() NOTE : introspection is now done at render time. Please look at the Parser.jjt file which is what controls the generation of this class.

Version:
$Id: ASTMethod.java 898032 2010-01-11 19:51:03Z nbubna $
Author:
Jason van Zyl, Geir Magnusson Jr.

Nested Class Summary
static class ASTMethod.MethodCacheKey
          Internal class used as key for method cache.
 
Field Summary
protected  boolean strictRef
          Indicates if we are running in strict reference mode.
protected  Info uberInfo
           
 
Fields inherited from class org.apache.velocity.runtime.parser.node.SimpleNode
children, first, id, info, invalid, last, log, parent, parser, rsvc, state, templateName
 
Constructor Summary
ASTMethod(int id)
           
ASTMethod(Parser p, int id)
           
 
Method Summary
 Object execute(Object o, InternalContextAdapter context)
          invokes the method.
 String getMethodName()
           
 Object init(InternalContextAdapter context, Object data)
          simple init - init our subtree and get what we can from the AST
 Object jjtAccept(ParserVisitor visitor, Object data)
           
 
Methods inherited from class org.apache.velocity.runtime.parser.node.SimpleNode
childrenAccept, dump, evaluate, getColumn, getFirstToken, getInfo, getLastToken, getLine, getLocation, getRuntimeServices, getTemplateName, getType, isInvalid, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent, literal, render, setFirstToken, setInfo, setInvalid, toString, toString, value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

uberInfo

protected Info uberInfo

strictRef

protected boolean strictRef
Indicates if we are running in strict reference mode.

Constructor Detail

ASTMethod

public ASTMethod(int id)
Parameters:
id -

ASTMethod

public ASTMethod(Parser p,
                 int id)
Parameters:
p -
id -
Method Detail

jjtAccept

public Object jjtAccept(ParserVisitor visitor,
                        Object data)
Specified by:
jjtAccept in interface Node
Overrides:
jjtAccept in class SimpleNode
Returns:
The Node execution result object.
See Also:
SimpleNode.jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object)

init

public Object init(InternalContextAdapter context,
                   Object data)
            throws TemplateInitException
simple init - init our subtree and get what we can from the AST

Specified by:
init in interface Node
Overrides:
init in class SimpleNode
Parameters:
context -
data -
Returns:
The init result
Throws:
TemplateInitException
See Also:
Node.init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)

execute

public Object execute(Object o,
                      InternalContextAdapter context)
               throws MethodInvocationException
invokes the method. Returns null if a problem, the actual return if the method returns something, or an empty string "" if the method returns void

Specified by:
execute in interface Node
Overrides:
execute in class SimpleNode
Parameters:
o -
context -
Returns:
Result or null.
Throws:
MethodInvocationException
See Also:
Node.execute(java.lang.Object, org.apache.velocity.context.InternalContextAdapter)

getMethodName

public String getMethodName()
Returns:
Returns the methodName.
Since:
1.5


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