Package 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:
  `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.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected boolean`
`strictRef`
Indicates if we are running in strict reference mode.
`protected Info`
`uberInfo`

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

`children, column, first, firstImage, id, info, invalid, last, lastImage, line, literal, log, parent, parser, rsvc, state, template`

## Constructor Summary

Constructors
Constructor
Description
`ASTMethod(int id)`
`ASTMethod(Parser p, int id)`

## Method Summary

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 AST
`Object`
`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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### uberInfo

protected Info uberInfo

### strictRef

protected boolean strictRef
Indicates if we are running in strict reference mode.

## Constructor Details

### ASTMethod

public ASTMethod(int id)

Parameters:
  `id` -

### ASTMethod

public ASTMethod(Parser p, int id)

Parameters:
  `p` -
  `id` -

## Method Details

### jjtAccept

public Object jjtAccept(StandardParserVisitor visitor, Object data)

Specified by:
  `jjtAccept` in interface `Node`
Overrides:
  `jjtAccept` in class `SimpleNode`
Parameters:
  `visitor` -
  `data` -
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 interface `Node`
Overrides:
  `init` in class `SimpleNode`
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 interface `Node`
Overrides:
  `execute` in class `SimpleNode`
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 interface `Node`
Overrides:
  `literal` in class `SimpleNode`
Returns:
See Also:
  - `Node.literal()`