|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectfreemarker.ext.beans2.MethodWrapper
public class MethodWrapper
Wraps a method identifier. The method identifier is resolved to a Method object when the method is invoked. This allows different Method objects to be invoked depending on the number and type of objects supplied to the call.
| Field Summary | |
|---|---|
protected static Converter[] |
emptyConverters
Convenience value for methods that need no argument conversions |
protected static TemplateModel[] |
emptyModelArguments
Convenience value for methods where no arguments were supplied |
protected static java.lang.Object[] |
emptyParamValues
Convenience value for methods that take zero arguments |
protected java.lang.String |
identifier
The name of the method, which may be overloaded, to be resolved against the object |
protected java.lang.Object |
object
The object on which the method will be called |
| Constructor Summary | |
|---|---|
MethodWrapper()
Default constructor where no target method object or identifier are supplied. |
|
MethodWrapper(java.lang.Object object,
java.lang.String identifier)
Constructor that takes an object on which the method will be called, and an identifier to resolve to a method. |
|
| 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)
Sets the identifier for the method, possibly overloaded. |
void |
setObject(java.lang.Object object)
Sets the object on which the method will be resolved and called. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.Object[] emptyParamValues
protected static final Converter[] emptyConverters
protected static final TemplateModel[] emptyModelArguments
protected java.lang.Object object
protected java.lang.String identifier
| Constructor Detail |
|---|
public MethodWrapper()
public MethodWrapper(java.lang.Object object,
java.lang.String identifier)
object - the object on which the method will be calledidentifier - the identifier for the method| Method Detail |
|---|
public void setObject(java.lang.Object object)
object - the object on which the method will be calledpublic void setIdentifier(java.lang.String identifier)
identifier - the identifier for the method
public boolean isEmpty()
throws TemplateModelException
TemplateModel
isEmpty in interface TemplateModeltrue if this object is empty, otherwise false
TemplateModelException
public TemplateModel exec(java.util.List<TemplateModel> arguments)
throws TemplateModelException
TemplateMethodModel2List of
TemplateModel objects.
exec in interface TemplateMethodModel2arguments - a List of TemplateModel objects
containing the values of the arguments passed to the method.
TemplateModel produced by the method, or null.
TemplateModelException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||