Package freemarker.template
Interface TemplateMethodModelEx
-
- All Superinterfaces:
TemplateMethodModel
,TemplateModel
- All Known Implementing Classes:
JythonHashModel
,JythonModel
,JythonNumberModel
,JythonSequenceModel
,MapModel
,ObjectConstructor
,OverloadedMethodsModel
,ResourceBundleModel
,RhinoFunctionModel
,SimpleMapModel
,SimpleMethodModel
public interface TemplateMethodModelEx extends TemplateMethodModel
"extended method" template language data type: Objects that act like functions. Their main application is calling Java methods viaBeansWrapper
, but you can implement this interface to create top-level functions too. They are "extended" compared to the deprecatedTemplateMethodModel
, which could only accept string parameters.In templates they are used like
myMethod(1, "foo")
ormyJavaObject.myJavaMethod(1, "foo")
.
-
-
Field Summary
-
Fields inherited from interface freemarker.template.TemplateModel
NOTHING
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Object
exec(java.util.List arguments)
Executes the method call.
-
-
-
Method Detail
-
exec
java.lang.Object exec(java.util.List arguments) throws TemplateModelException
Executes the method call.- Specified by:
exec
in interfaceTemplateMethodModel
- Parameters:
arguments
- aList
ofTemplateModel
-s, containing the arguments passed to the method. If the implementation absolutely wants to operate on POJOs, it can use the static utility methods in theDeepUnwrap
class to easily obtain them. However, unwrapping is not always possible (or not perfectly), and isn't always efficient, so it's recommended to use the originalTemplateModel
value as much as possible.- Returns:
- the return value of the method, or
null
. If the returned value does not implementTemplateModel
, it will be automatically wrapped using theenvironment's object wrapper
. - Throws:
TemplateModelException
-
-