public class OverloadedMethodsModel extends java.lang.Object implements TemplateMethodModelEx, TemplateSequenceModel
TemplateMethodModel
interface,
like if it was a single method, chooses among them behind the scenes on call-time based on the argument values.NOTHING
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
exec(java.util.List arguments)
Invokes the method, passing it the arguments from the list.
|
TemplateModel |
get(int index)
Retrieves the i-th template model in this sequence.
|
int |
size() |
public java.lang.Object exec(java.util.List arguments) throws TemplateModelException
exec
in interface TemplateMethodModel
exec
in interface TemplateMethodModelEx
arguments
- a List
of TemplateModel
-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 the DeepUnwrap
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 original TemplateModel
value as much as possible.null
. If the returned value
does not implement TemplateModel
, it will be automatically
wrapped using the environment's
object wrapper
.TemplateModelException
- if the method cannot be chosen
unambiguously.public TemplateModel get(int index) throws TemplateModelException
TemplateSequenceModel
get
in interface TemplateSequenceModel
null
if
the index is out of bounds. Note that a null
value is
interpreted by FreeMarker as "variable does not exist", and accessing
a missing variables is usually considered as an error in the FreeMarker
Template Language, so the usage of a bad index will not remain hidden.TemplateModelException
public int size() throws TemplateModelException
size
in interface TemplateSequenceModel
TemplateModelException