Package freemarker.template
The fundamental, most commonly used API-s of FreeMarker;
start with Configuration
(see also the
Getting Stared in the Manual.)
-
Interface Summary Interface Description AdapterTemplateModel ATemplateModel
that can be unwrapped and then it considers a provided desired (hint) class.ObjectWrapper Maps Java objects to the type-system of FreeMarker Template Language (see theTemplateModel
interfaces).ObjectWrapperAndUnwrapper Experimental - subject to change: Adds functionality toObjectWrapper
that creates a plain Java object from aTemplateModel
.TemplateBooleanModel "boolean" template language data type; same as in Java; eithertrue
orfalse
.TemplateCollectionModel "collection" template language data type: a collection of values that can be enumerated, but can't be or not meant to be accessed by index or key.TemplateCollectionModelEx Experimental - subject to change: "extended collection" template language data type: Adds size/emptiness querybility and "contains" test toTemplateCollectionModel
.TemplateDateModel "date", "time" and "date-time" template language data types: corresponds toDate
.TemplateDirectiveBody Represents the nested content of a directive (TemplateDirectiveModel
) invocation.TemplateDirectiveModel "directive" template language data type: used as user-defined directives (much like macros) in templates.TemplateExceptionHandler Used for thetemplate_exception_handler
configuration setting; seeConfigurable.setTemplateExceptionHandler(TemplateExceptionHandler)
for more.TemplateHashModel "hash" template language data type: an object that contains other objects accessible through string keys (sub-variable names).TemplateHashModelEx "extended hash" template language data type; extendsTemplateHashModel
by allowing iterating through its keys and values.TemplateMethodModel Deprecated. UseTemplateMethodModelEx
instead.TemplateMethodModelEx "extended method" template language data type: Objects that act like functions.TemplateModel The common super-interface of the interfaces that stand for the FreeMarker Template Language (FTL) data types.TemplateModelAdapter Implemented by classes that serve as adapters for template model objects in some other object model.TemplateModelIterator Used to iterate over a set of template models once; usually returned fromTemplateCollectionModel.iterator()
.TemplateModelWithAPISupport Experimental - subject to change: ATemplateModel
on which the?api
operation can be applied.TemplateNodeModel "node" template language data type: an object that is a node in a tree.TemplateNumberModel "number" template language data type; an object that stores a number.TemplateScalarModel "string" template language data-type; like in Java, an unmodifiable UNICODE character sequence.TemplateSequenceModel "sequence" template language data type; an object that contains other objects accessible through an integer 0-based index.TemplateTransformModel "transform" template language data type: user-defined directives (much like macros) specialized on filtering output; you should rather use the newerTemplateDirectiveModel
instead.TransformControl An interface that can be implemented by writers returned fromTemplateTransformModel.getWriter(java.io.Writer, java.util.Map)
. -
Class Summary Class Description Configuration The main entry point into the FreeMarker API; encapsulates the configuration settings of FreeMarker, also serves as a central template-loading and caching service.DefaultArrayAdapter Adapts anarray
of a non-primitive elements to the correspondingTemplateModel
interface(s), most importantly toTemplateHashModelEx
.DefaultIteratorAdapter Adapts anIterator
to the correspondingTemplateModel
interface(s), most importantly toTemplateCollectionModel
.DefaultListAdapter Adapts aList
to the correspondingTemplateModel
interface(s), most importantly toTemplateSequenceModel
.DefaultMapAdapter Adapts aMap
to the correspondingTemplateModel
interface(s), most importantly toTemplateHashModelEx
.DefaultNonListCollectionAdapter Experimental - subject to change: Adapts a non-List
JavaCollection
to the correspondingTemplateModel
interface(s), most importantly toTemplateCollectionModelEx
.DefaultObjectWrapper The default implementation of theObjectWrapper
interface.DefaultObjectWrapperBuilder Gets/creates aDefaultObjectWrapper
singleton instance that's already configured as specified in the properties of this object; this is recommended over using theDefaultObjectWrapper
constructors.DefaultObjectWrapperConfiguration HoldsDefaultObjectWrapper
configuration settings and defines their defaults.LocalizedString An abstract base class for scalars that vary by locale.ResourceBundleLocalizedString A concrete implementation ofLocalizedString
that gets a localized string from aResourceBundle
SimpleCollection A simple implementation ofTemplateCollectionModel
.SimpleDate A simple implementation of the TemplateDateModel interface.SimpleHash A simple implementation of theTemplateHashModelEx
interface, using its own underlyingMap
orSortedMap
for storing the hash entries.SimpleList Deprecated. Use SimpleSequence instead.SimpleNumber A simple implementation of the TemplateNumberModel interface.SimpleObjectWrapper A restricted object wrapper that will not expose arbitrary object, just those that directly correspond to theTemplateModel
sub-interfaces (String
,Map
and such).SimpleScalar A simple implementation of the TemplateScalarModel interface, using a String.SimpleSequence A simple implementation of theTemplateSequenceModel
interface, using its own underlyingList
for storing the list items.Template Stores an already parsed template, ready to be processed (rendered) for unlimited times, possibly from multiple threads.TemplateModelListSequence A sequence that wraps aList
ofTemplateModel
-s.Version Represents a version number plus the further qualifiers and build info.WrappingTemplateModel Convenience base-class for containers that wrap their contained arbitrary Java objects intoTemplateModel
instances. -
Exception Summary Exception Description MalformedTemplateNameException Indicates that the template name given was malformed according theTemplateNameFormat
in use.Template.WrongEncodingException Thrown by theTemplate
constructors that specify a non-null
encoding whoch doesn't match the encoding specified in the#ftl
header of the template.TemplateException Runtime exception in a template (as opposed to a parsing-time exception:ParseException
).TemplateModelException TemplateModel
methods throw this exception if the requested data can't be retrieved.TemplateNotFoundException Thrown whenConfiguration.getTemplate(String)
(or similar) doesn't find a template.