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 class
ASTMethod.MethodCacheKey
Internal class used as key for method cache.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
methodName
private int
paramCount
protected boolean
strictRef
Indicates if we are running in strict reference mode.protected Info
uberInfo
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
execute(java.lang.Object o, InternalContextAdapter context)
invokes the method.java.lang.String
getMethodName()
private java.lang.Object
handleInvocationException(java.lang.Object o, InternalContextAdapter context, java.lang.Throwable t)
java.lang.Object
init(InternalContextAdapter context, java.lang.Object data)
simple init - init our subtree and get what we can from the ASTjava.lang.Object
jjtAccept(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:
jjtAccept
in interfaceNode
- Overrides:
jjtAccept
in 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:
init
in interfaceNode
- Overrides:
init
in 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 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 interfaceNode
- Overrides:
execute
in 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
-
-