Class ASTMethod
- java.lang.Object
-
- org.apache.velocity.runtime.parser.node.SimpleNode
-
- org.apache.velocity.runtime.parser.node.ASTMethod
-
- All Implemented Interfaces:
Cloneable
,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$
- Author:
- Jason van Zyl, Geir Magnusson Jr.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ASTMethod.MethodCacheKey
Internal class used as key for method cache.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 ASTObject
jjtAccept(StandardParserVisitor visitor, Object data)
String
literal()
Returns the string ".method_name(...)".-
Methods inherited from class org.apache.velocity.runtime.parser.node.SimpleNode
childrenAccept, cleanupParserAndTokens, clone, clone, dump, dump, dump, evaluate, getColumn, getFirstToken, getFirstTokenImage, getInfo, getLastToken, getLastTokenImage, getLine, getLocation, getParser, getRuntimeServices, getTemplate, getTemplateName, getType, isInvalid, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent, render, saveTokenImages, setFirstToken, setInfo, setInvalid, toString, toString, value
-
-
-
-
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(StandardParserVisitor visitor, 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.StandardParserVisitor, 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 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 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 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)
-
getMethodName
public String getMethodName()
- Returns:
- Returns the methodName.
- Since:
- 1.5
-
literal
public String literal()
Returns the string ".method_name(...)". Arguments literals are not rendered. This method is only used for displaying the VTL stacktrace when a rendering error is encountered when runtime.log.track_location is true.- Specified by:
literal
in interfaceNode
- Overrides:
literal
in classSimpleNode
- Returns:
- See Also:
Node.literal()
-
-