Class ASTMethod
- java.lang.Object
-
- org.apache.velocity.runtime.parser.node.SimpleNode
-
- 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 $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classASTMethod.MethodCacheKeyInternal class used as key for method cache.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringmethodNameprivate intparamCountprotected booleanstrictRefIndicates if we are running in strict reference mode.protected InfouberInfo
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectexecute(java.lang.Object o, InternalContextAdapter context)invokes the method.java.lang.StringgetMethodName()private java.lang.ObjecthandleInvocationException(java.lang.Object o, InternalContextAdapter context, java.lang.Throwable t)java.lang.Objectinit(InternalContextAdapter context, java.lang.Object data)simple init - init our subtree and get what we can from the ASTjava.lang.ObjectjjtAccept(ParserVisitor visitor, java.lang.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
-
-
-
-
Field Detail
-
methodName
private java.lang.String methodName
-
paramCount
private int paramCount
-
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 java.lang.Object jjtAccept(ParserVisitor visitor, java.lang.Object data)
- Specified by:
jjtAcceptin interfaceNode- Overrides:
jjtAcceptin classSimpleNode- Returns:
- The Node execution result object.
- See Also:
SimpleNode.jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object)
-
init
public java.lang.Object init(InternalContextAdapter context, java.lang.Object data) throws TemplateInitException
simple init - init our subtree and get what we can from the AST- Specified by:
initin interfaceNode- Overrides:
initin classSimpleNode- Parameters:
context-data-- Returns:
- The init result
- Throws:
TemplateInitException- See Also:
Node.init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)
-
execute
public java.lang.Object execute(java.lang.Object o, InternalContextAdapter context) throws MethodInvocationExceptioninvokes 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:
executein interfaceNode- Overrides:
executein classSimpleNode- Parameters:
o-context-- Returns:
- Result or null.
- Throws:
MethodInvocationException- See Also:
Node.execute(java.lang.Object, org.apache.velocity.context.InternalContextAdapter)
-
handleInvocationException
private java.lang.Object handleInvocationException(java.lang.Object o, InternalContextAdapter context, java.lang.Throwable t)
-
getMethodName
public java.lang.String getMethodName()
- Returns:
- Returns the methodName.
- Since:
- 1.5
-
-