public interface TemplateModel
TemplateModel-s, not with plain objects. This is why the data-model
(aka. the "template context" in other languages) is (automatically) mapped to a tree of TemplateModel-s.
Mapping the plain Java objects to TemplateModel-s (or the other way around sometimes) is the
responsibility of the ObjectWrapper (can be set via Configurable.setObjectWrapper(ObjectWrapper)).
But not all TemplateModel-s are for wrapping a plain object. For example, a value created within a template
is not made to wrap an earlier existing object; it's a value that has always existed in the template language's
domain. Users can also write TemplateModel implementations and put them directly into the data-model for
full control over how that object is seen from the template. Certain TemplateModel interfaces may doesn't
even have equivalent in Java. For example the directive type (TemplateDirectiveModel) is like that.
Because TemplateModel "subclasses" are all interfaces, a value in the template language can have multiple
types. However, to prevent ambiguous situations, it's not recommended to make values that implement more than one of
these types: string, number, boolean, date. The intended applications are like string+hash, string+method,
hash+sequence, etc.
| Modifier and Type | Field and Description |
|---|---|
static TemplateModel |
NOTHING
A general-purpose object to represent nothing.
|
static final TemplateModel NOTHING