AdapterTemplateModel
, TemplateBooleanModel
, TemplateCollectionModel
, TemplateCollectionModelEx
, TemplateDateModel
, TemplateDirectiveModel
, TemplateHashModel
, TemplateHashModelEx
, TemplateMethodModel
, TemplateMethodModelEx
, TemplateModelWithAPISupport
, TemplateNodeModel
, TemplateNumberModel
, TemplateScalarModel
, TemplateSequenceModel
, TemplateTransformModel
, WrapperTemplateModel
AllHttpScopesHashModel
, ArrayModel
, BeanModel
, BooleanModel
, CaptureOutput
, CollectionModel
, DateModel
, DefaultArrayAdapter
, DefaultIteratorAdapter
, DefaultListAdapter
, DefaultMapAdapter
, DefaultNonListCollectionAdapter
, DOMNodeModel
, EnumerationModel
, Environment.Namespace
, Execute
, HtmlEscape
, HttpRequestHashModel
, HttpRequestParametersHashModel
, HttpSessionHashModel
, IncludePage
, IteratorModel
, JythonHashModel
, JythonModel
, JythonNumberModel
, JythonRuntime
, JythonSequenceModel
, LocalizedString
, MapModel
, NodeListModel
, NodeListModel
, NodeModel
, NormalizeNewlines
, NumberModel
, ObjectConstructor
, OverloadedMethodsModel
, ResourceBundleLocalizedString
, ResourceBundleModel
, RhinoFunctionModel
, RhinoScriptableModel
, ServletContextHashModel
, SimpleCollection
, SimpleDate
, SimpleHash
, SimpleList
, SimpleMapModel
, SimpleMethodModel
, SimpleNumber
, SimpleScalar
, SimpleSequence
, StandardCompress
, StringModel
, TaglibFactory
, TemplateModelListSequence
, XmlEscape
public interface TemplateModel
TemplateModel
-s, not directly with plain Java objects. (For example,
it doesn't understand Number
, but TemplateNumberModel
.) 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 Configuration.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 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 | Description |
---|---|---|
static TemplateModel |
NOTHING |
A general-purpose object to represent nothing.
|
static final TemplateModel NOTHING