Class DefaultIteratorAdapter

java.lang.Object
freemarker.template.WrappingTemplateModel
freemarker.template.DefaultIteratorAdapter
All Implemented Interfaces:
WrapperTemplateModel, AdapterTemplateModel, TemplateCollectionModel, TemplateModel, TemplateModelWithAPISupport, Serializable

Adapts an Iterator to the corresponding TemplateModel interface(s), most importantly to TemplateCollectionModel. The resulting TemplateCollectionModel can only be listed (iterated) once. If the user tries list the variable for a second time, an exception will be thrown instead of silently gettig an empty (or partial) listing.

Thread safety: A DefaultListAdapter is as thread-safe as the array that it wraps is. Normally you only have to consider read-only access, as the FreeMarker template language doesn't allow writing these sequences (though of course, Java methods called from the template can violate this rule).

This adapter is used by DefaultObjectWrapper if its useAdaptersForCollections property is true, which is the default when its incompatibleImprovements property is 2.3.22 or higher.

Since:
2.3.22
See Also:
Serialized Form