default object wrapper
of FreeMarker uses
this to expose Java Beans and POJO-s to templates, but it can also be used in itself as a
better alternative ObjectWrapper
.See: Description
Class | Description |
---|---|
ArrayModel |
A class that will wrap an arbitrary array into
TemplateCollectionModel
and TemplateSequenceModel interfaces. |
BeanModel |
A class that will wrap an arbitrary object into
TemplateHashModel
interface allowing calls to arbitrary property getters and invocation of
accessible methods on the object from a template using the
object.foo to access properties and object.bar(arg1, arg2) to
invoke methods on it. |
BeansModelCache | |
BeansWrapper |
Utility class that provides generic services to reflection classes.
|
BeansWrapper.MethodAppearanceDecision |
Experimental class; subject to change!
|
BooleanModel |
A class that will wrap instances of
Boolean into a
TemplateBooleanModel . |
CollectionModel |
A special case of
BeanModel that can wrap Java collections
and that implements the TemplateCollectionModel in order to be usable
in a <foreach> block. |
DateModel |
Wraps arbitrary subclass of
Date into a reflective model. |
EnumerationModel |
A class that adds
TemplateModelIterator functionality to the
Enumeration interface implementers. |
HashAdapter | |
IteratorModel |
A class that adds
TemplateModelIterator functionality to the
Iterator interface implementers. |
MapModel |
A special case of
BeanModel that adds implementation
for TemplateMethodModelEx on map objects that is a shortcut for the
Map.get() method. |
NumberModel |
Wraps arbitrary subclass of
Number into a reflective model. |
OverloadedMethodsModel |
Wraps a set of same-name overloaded methods behind
TemplateMethodModel interface,
like if it was a single method, chooses among them behind the scenes on call-time based on the argument values. |
ResourceBundleModel |
A hash model that wraps a resource bundle.
|
SimpleMapModel |
Model used by
BeansWrapper when simpleMapWrapper
mode is enabled. |
SimpleMethodModel |
A class that will wrap a reflected method call into a
TemplateMethodModel interface. |
StringModel |
Subclass of
BeanModel that exposes the return value of the Object.toString() method through the TemplateScalarModel
interface. |
Exception | Description |
---|---|
InvalidPropertyException |
An exception thrown when there is an attempt to access
an invalid bean property when we are in a "strict bean" mode
|
The default object wrapper
of FreeMarker uses
this to expose Java Beans and POJO-s to templates, but it can also be used in itself as a
better alternative ObjectWrapper
.
Most of the issues dealing with beans are handled by the
BeansWrapper.wrap(Object)
and BeansWrapper.getStaticModels()
methods. In normal cases,
these are the only methods
you should use to turn an arbitrary Java object into a
FreeMarker TemplateModel
. Additionally, you can manually create
instance of any wrapper class using its constructors.
Note, however that in such cases you bypass the eventual model caching
of the wrapper.