Class DefaultMapAdapter

java.lang.Object
freemarker.template.WrappingTemplateModel
freemarker.template.DefaultMapAdapter
All Implemented Interfaces:
WrapperTemplateModel, AdapterTemplateModel, TemplateHashModel, TemplateHashModelEx, TemplateHashModelEx2, TemplateModel, TemplateModelWithAPISupport, Serializable

Adapts a Map to the corresponding TemplateModel interface(s), most importantly to TemplateHashModelEx. If you aren't wrapping an already existing Map, but build a hash specifically to be used from a template, also consider using SimpleHash (see comparison there).

Thread safety: A DefaultMapAdapter is as thread-safe as the Map that it wraps is. Normally you only have to consider read-only access, as the FreeMarker template language doesn't allow writing these hashes (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