org.apache.velocity.runtime.parser.node

Class ASTMethod

Implemented Interfaces:
Node

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,v 1.24.4.1 2004/03/03 23:22:59 geirm Exp $

Authors:
Jason van Zyl
Geir Magnusson Jr.

Field Summary

private String
methodName
private int
paramCount

Fields inherited from class org.apache.velocity.runtime.parser.node.SimpleNode

children, first, id, info, invalid, last, parent, parser, rsvc, state

Constructor Summary

ASTMethod(int id)
ASTMethod(Parser p, int id)

Method Summary

Object
execute(Object o, InternalContextAdapter context)
invokes the method.
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)
Accept the visitor.

Methods inherited from class org.apache.velocity.runtime.parser.node.SimpleNode

childrenAccept, dump, evaluate, execute, getColumn, getFirstToken, getInfo, getLastToken, getLine, getType, init, isInvalid, jjtAccept, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent, literal, render, setFirstToken, setInfo, setInvalid, toString, value

Field Details

methodName

private String methodName


paramCount

private int paramCount

Constructor Details

ASTMethod

public ASTMethod(int id)


ASTMethod

public ASTMethod(Parser p,
                 int id)

Method Details

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 interface SimpleNode


init

public Object init(InternalContextAdapter context,
                   Object data)
            throws Exception
simple init - init our subtree and get what we can from the AST
Specified by:
init in interface Node
Overrides:
init in interface SimpleNode


jjtAccept

public Object jjtAccept(ParserVisitor visitor,
                        Object data)
Accept the visitor. *
Specified by:
jjtAccept in interface Node
Overrides:
jjtAccept in interface SimpleNode


Copyright B) 2002 Apache Software Foundation. All Rights Reserved.