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

java.lang.Object
  |
  +--org.apache.velocity.runtime.parser.node.SimpleNode
        |
        +--org.apache.velocity.runtime.parser.node.ASTMethod
All 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.21.2.1 2002/05/09 03:17:03 geirm Exp $
Author:
Jason van Zyl, Geir Magnusson Jr.

Field Summary
private  java.lang.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
private  java.lang.reflect.Method doIntrospection(InternalContextAdapter context, java.lang.Class data, java.lang.Object[] params)
          does the instrospection of the class for the method needed.
 java.lang.Object execute(java.lang.Object o, InternalContextAdapter context)
          invokes the method.
 java.lang.Object init(InternalContextAdapter context, java.lang.Object data)
          simple init - init our subtree and get what we can from the AST
 java.lang.Object jjtAccept(ParserVisitor visitor, java.lang.Object data)
          Accept the visitor.
 
Methods inherited from class org.apache.velocity.runtime.parser.node.SimpleNode
childrenAccept, dump, evaluate, getColumn, getFirstToken, getInfo, getLastToken, getLine, getType, isInvalid, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent, literal, render, setFirstToken, setInfo, setInvalid, toString, value
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

methodName

private java.lang.String methodName

paramCount

private int paramCount
Constructor Detail

ASTMethod

public ASTMethod(int id)

ASTMethod

public ASTMethod(Parser p,
                 int id)
Method Detail

jjtAccept

public java.lang.Object jjtAccept(ParserVisitor visitor,
                                  java.lang.Object data)
Accept the visitor.
Overrides:
jjtAccept in class SimpleNode

init

public java.lang.Object init(InternalContextAdapter context,
                             java.lang.Object data)
                      throws java.lang.Exception
simple init - init our subtree and get what we can from the AST
Overrides:
init in class SimpleNode

doIntrospection

private java.lang.reflect.Method doIntrospection(InternalContextAdapter context,
                                                 java.lang.Class data,
                                                 java.lang.Object[] params)
                                          throws MethodInvocationException,
                                                 java.lang.Exception
does the instrospection of the class for the method needed. Note, as this calls value() on the args if any, this must only be called at execute() / render() time

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
Overrides:
execute in class SimpleNode


Copyright © 2003 Apache Software Foundation. All Rights Reserved.