freemarker.ext.beans2
Class MethodWrapper

java.lang.Object
  extended by freemarker.ext.beans2.MethodWrapper
All Implemented Interfaces:
TemplateMethodModel2, TemplateModel

public class MethodWrapper
extends java.lang.Object
implements TemplateMethodModel2

Wraps an identifier. An identifier can be a method name, a property name, or a field name. This class encapsulates these possibilities. Note that an identifier could be an indexed property name, in which case we use the IndexedPropertyWrapper, a subclass of this.

Since:
1.9
Version:
$Id: MethodWrapper.java 1109 2005-09-09 11:21:12Z run2000 $
Author:
Nicholas Cull

Field Summary
protected static Converter[] emptyConverters
           
protected static TemplateModel[] emptyModelArguments
           
protected static java.lang.Object[] emptyParamValues
           
protected  java.lang.String identifier
           
protected  java.lang.Object object
           
 
Constructor Summary
MethodWrapper()
           
MethodWrapper(java.lang.Object object, java.lang.String identifier)
           
 
Method Summary
 TemplateModel exec(java.util.List<TemplateModel> arguments)
          Executes a method call.
 boolean isEmpty()
          Is the object empty?
 void setIdentifier(java.lang.String identifier)
           
 void setObject(java.lang.Object object)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

emptyParamValues

protected static final java.lang.Object[] emptyParamValues

emptyConverters

protected static final Converter[] emptyConverters

emptyModelArguments

protected static final TemplateModel[] emptyModelArguments

object

protected java.lang.Object object

identifier

protected java.lang.String identifier
Constructor Detail

MethodWrapper

public MethodWrapper()

MethodWrapper

public MethodWrapper(java.lang.Object object,
                     java.lang.String identifier)
Method Detail

setObject

public void setObject(java.lang.Object object)

setIdentifier

public void setIdentifier(java.lang.String identifier)

isEmpty

public boolean isEmpty()
                throws TemplateModelException
Description copied from interface: TemplateModel
Is the object empty?

Specified by:
isEmpty in interface TemplateModel
Returns:
true if this object is empty, otherwise false
Throws:
TemplateModelException

exec

public TemplateModel exec(java.util.List<TemplateModel> arguments)
                   throws TemplateModelException
Description copied from interface: TemplateMethodModel2
Executes a method call. Arguments are passed as a List of TemplateModel objects.

Specified by:
exec in interface TemplateMethodModel2
Parameters:
arguments - a List of TemplateModel objects containing the values of the arguments passed to the method.
Returns:
the TemplateModel produced by the method, or null.
Throws:
TemplateModelException