Class DefaultNonListCollectionAdapter

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

Adapts a non-List Java Collection to the corresponding TemplateModel interface(s), most importantly to TemplateCollectionModelEx. For List-s, use DefaultListAdapter, or else you lose indexed element access.

Thread safety: A DefaultNonListCollectionAdapter is as thread-safe as the Collection that it wraps is. Normally you only have to consider read-only access, as the FreeMarker template language doesn't allow writing these collections (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, and its forceLegacyNonListCollections property is false, which is still not the default as of 2.3.22 (so you have to set it explicitly).

Since:
2.3.22
See Also:
Serialized Form