org.szegedi.expose.model
Class ReflectionMethodModel

java.lang.Object
  |
  +--org.szegedi.expose.model.ReflectionMethodModel
All Implemented Interfaces:
freemarker.template.TemplateMethodModel, freemarker.template.TemplateModel

public final class ReflectionMethodModel
extends java.lang.Object
implements freemarker.template.TemplateMethodModel

A class that will wrap a reflected method call into a TemplateMethodModel interface. It can be used directly, and is heavily used by ReflectionObjectModel to wrap reflected method calls.

Version:
1.0
Author:
Attila Szegedi, attila@szegedi.org

Constructor Summary
ReflectionMethodModel(java.lang.Object object, java.lang.reflect.Method method)
          Creates a model for a specific method on a specific object.
 
Method Summary
 freemarker.template.TemplateModel exec(java.util.List arguments)
          Invokes the method, passing it the arguments from the list.
 boolean isEmpty()
          Returns true if the wrapped method's return type is void.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionMethodModel

public ReflectionMethodModel(java.lang.Object object,
                             java.lang.reflect.Method method)
Creates a model for a specific method on a specific object.
Parameters:
object - the object to call the method on. Can be null for static methods.
method - the method that will be invoked.
Method Detail

exec

public freemarker.template.TemplateModel exec(java.util.List arguments)
                                       throws freemarker.template.TemplateModelException
Invokes the method, passing it the arguments from the list. As in current release of Freemarker (1.52), all elements of the argument list are Strings, the method must be callable with all-String parameters.
Specified by:
exec in interface freemarker.template.TemplateMethodModel

isEmpty

public boolean isEmpty()
Returns true if the wrapped method's return type is void.
Specified by:
isEmpty in interface freemarker.template.TemplateModel