|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object freemarker.ext.beans2.StaticMethodWrapper
public class StaticMethodWrapper
Wraps a static 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 java.lang.Class |
clazz
The class on which the method will be called |
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 class |
Constructor Summary | |
---|---|
StaticMethodWrapper()
Default constructor where no target class or identifier are supplied. |
|
StaticMethodWrapper(java.lang.Class clazz,
java.lang.String identifier)
Constructor that takes a class 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 |
setClazz(java.lang.Class clazz)
Sets the class on which the method will be resolved and called. |
void |
setIdentifier(java.lang.String identifier)
Sets the identifier for the method, possibly overloaded. |
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.Class clazz
protected java.lang.String identifier
Constructor Detail |
---|
public StaticMethodWrapper()
public StaticMethodWrapper(java.lang.Class clazz, java.lang.String identifier)
clazz
- the class on which the method will be calledidentifier
- the identifier for the methodMethod Detail |
---|
public void setClazz(java.lang.Class clazz)
clazz
- the class on which the method will be calledpublic void setIdentifier(java.lang.String identifier)
identifier
- the identifier for the methodpublic boolean isEmpty() throws TemplateModelException
TemplateModel
isEmpty
in interface TemplateModel
true
if this object is empty, otherwise false
TemplateModelException
public TemplateModel exec(java.util.List<TemplateModel> arguments) throws TemplateModelException
TemplateMethodModel2
List
of
TemplateModel
objects.
exec
in interface TemplateMethodModel2
arguments
- 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 |