Interface TemplateCollectionModel
- All Superinterfaces:
TemplateModel
- All Known Subinterfaces:
TemplateCollectionModelEx
- All Known Implementing Classes:
ArrayModel
,CollectionModel
,DefaultEnumerationAdapter
,DefaultIterableAdapter
,DefaultIteratorAdapter
,DefaultNonListCollectionAdapter
,EnumerationModel
,IteratorModel
,JythonSequenceModel
,NodeListModel
,SimpleCollection
Iterable
interface (but it predates that interface, hence the unfortunate class name).
Note that this is not a super-interface of TemplateSequenceModel
, and implementations of that interface
needn't also implement this interface just because they can. They should though, if enumeration with this interface
is significantly faster than enumeration by index. The #list
directive will enumerate using this interface if
it's available.
The enumeration should be repeatable if that's possible with reasonable effort, otherwise a second enumeration
attempt is allowed to throw an TemplateModelException
. Generally, the interface user Java code need not
handle that kind of exception, as in practice only the template author can handle it, by not listing such collections
twice.
Note that to wrap Java's Collection
, you should implement TemplateCollectionModelEx
, not just this
interface.
-
Field Summary
Fields inherited from interface freemarker.template.TemplateModel
NOTHING
-
Method Summary
Modifier and TypeMethodDescriptioniterator()
Retrieves a template model iterator that is used to iterate over the elements in this collection.
-
Method Details
-
iterator
Retrieves a template model iterator that is used to iterate over the elements in this collection.- Throws:
TemplateModelException
-