Package freemarker.template
Class TemplateModelListSequence
- java.lang.Object
-
- freemarker.template.TemplateModelListSequence
-
- All Implemented Interfaces:
TemplateModel,TemplateSequenceModel
public class TemplateModelListSequence extends Object implements TemplateSequenceModel
Sequence that wraps ajava.util.Listof already wrapped objects directly, with minimal resource usage. Warning! It does not copy the original list.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface freemarker.template.TemplateModel
TemplateModel.InvalidExpressionModel, TemplateModel.JavaNull
-
-
Field Summary
-
Fields inherited from interface freemarker.template.TemplateModel
INVALID_EXPRESSION, JAVA_NULL, NOTHING
-
-
Constructor Summary
Constructors Constructor Description TemplateModelListSequence(List list)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TemplateModelget(int index)Retrieves the i-th template model in this sequence.ObjectgetWrappedObject()intsize()
-
-
-
Constructor Detail
-
TemplateModelListSequence
public TemplateModelListSequence(List list)
-
-
Method Detail
-
get
public TemplateModel get(int index)
Description copied from interface:TemplateSequenceModelRetrieves the i-th template model in this sequence.- Specified by:
getin interfaceTemplateSequenceModel- Returns:
- the item at the specified index, or
nullif the index is out of bounds. Note that anullvalue 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.
-
size
public int size()
- Specified by:
sizein interfaceTemplateSequenceModel- Returns:
- the number of items in the list.
-
getWrappedObject
public Object getWrappedObject()
-
-