Package freemarker.template
Class TemplateModelListSequence
java.lang.Object
freemarker.template.TemplateModelListSequence
- All Implemented Interfaces:
TemplateModel
,TemplateSequenceModel
A sequence that wraps a
List
of TemplateModel
-s. It does not copy the original
list. It's mostly useful when implementing TemplateMethodModelEx
-es that collect items from other
TemplateModel
-s.-
Field Summary
Fields inherited from interface freemarker.template.TemplateModel
NOTHING
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionget(int index)
Retrieves the i-th template model in this sequence.Returns the originalList
ofTemplateModel
-s, so it's not a fully unwrapped value.int
size()
-
Constructor Details
-
TemplateModelListSequence
-
-
Method Details
-
get
Description copied from interface:TemplateSequenceModel
Retrieves the i-th template model in this sequence.- Specified by:
get
in interfaceTemplateSequenceModel
- Returns:
- the item at the specified index, or
null
if the index is out of bounds. Note that anull
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, unless the default value for that case was also specified in the template.
-
size
public int size()- Specified by:
size
in interfaceTemplateSequenceModel
- Returns:
- the number of items in the list.
-
getWrappedObject
Returns the originalList
ofTemplateModel
-s, so it's not a fully unwrapped value.
-