- All Implemented Interfaces:
- TemplateHashModel, TemplateModel, TemplateScalarModel
public class TemplateMapModel
extends Object
implements TemplateHashModel, TemplateScalarModel
Adapts a Map of property names and values to Freemarker's TemplateModel interface.
Properties of the form "foo.bar" need special handling, as FreeMarker considers a period
to be a dereference operator, and thus first looks up property "foo", and then in the result looks up
property "bar". So we store these properties in the same fashion.
This class can represent both a simple string value for a given property, or a map of properties.
This allows it to store the properties "foo.bar=one" and "foo.bar.baz=two" as follows. The property "foo"
is mapped to instance #2 of this class. Instance #2 has property "bar", which maps to instance #3
that holds the string value "one" and holds the property "baz" which maps to instance #4 that just holds
the string value "two".