org.apache.velocity.runtime.parser.node
Class ASTIdentifier
java.lang.Object
|
+--org.apache.velocity.runtime.parser.node.SimpleNode
|
+--org.apache.velocity.runtime.parser.node.ASTIdentifier
- All Implemented Interfaces:
- Node
- public class ASTIdentifier
- extends SimpleNode
ASTIdentifier.java
Method support for identifiers : $foo
mainly used by ASTRefrence
Introspection is now moved to 'just in time' or at render / execution
time. There are many reasons why this has to be done, but the
primary two are thread safety, to remove any context-derived
information from class member variables.
- Version:
- $Id: ASTIdentifier.java,v 1.16 2001/11/19 13:53:08 geirm Exp $
- Author:
- Jason van Zyl, Geir Magnusson Jr.
Method Summary |
private AbstractExecutor |
doIntrospection(java.lang.Class data)
introspects the class to find the method name of the node,
or if that fails, treats the reference object as a map
and treats the identifier as a key in that map. |
java.lang.Object |
execute(java.lang.Object o,
InternalContextAdapter context)
invokes the method on the object passed in |
java.lang.Object |
init(InternalContextAdapter context,
java.lang.Object data)
simple init - don't do anything that is context specific. |
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 |
identifier
private java.lang.String identifier
ASTIdentifier
public ASTIdentifier(int id)
ASTIdentifier
public ASTIdentifier(Parser p,
int id)
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 - don't do anything that is context specific.
just get what we need from the AST, which is static.
- Overrides:
init
in class SimpleNode
doIntrospection
private AbstractExecutor doIntrospection(java.lang.Class data)
throws java.lang.Exception
- introspects the class to find the method name of the node,
or if that fails, treats the reference object as a map
and treats the identifier as a key in that map.
This needs work.
- Parameters:
data
- Class to be introspected
execute
public java.lang.Object execute(java.lang.Object o,
InternalContextAdapter context)
throws MethodInvocationException
- invokes the method on the object passed in
- Overrides:
execute
in class SimpleNode
Copyright © 2003 Apache Software Foundation. All Rights Reserved.