Save This Page
Home » freemarker-2.3.13 » freemarker.template » [javadoc | source]
freemarker.template
public interface: TemplateHashModelEx [javadoc | source]

All Implemented Interfaces:
    TemplateHashModel

All Known Implementing Classes:
    JythonHashModel, ConcatenatedHashEx, EnumerationModel, DebugEnvironmentModel, DebugConfigurationModel, AllHttpScopesHashModel, DebugTemplateModel, EmptyStringAndSequence, RhinoScriptableModel, SimpleHash, DateModel, ResourceBundleModel, BooleanModel, StaticModel, SimpleMapModel, StringModel, DebugMapModel, CollectionModel, HttpRequestHashModel, ArrayModel, DebugConfigurableModel, BeanModel, GeneralPurposeNothing, HttpRequestParametersHashModel, MapModel, SequenceHash, NumberModel, Namespace, RhinoFunctionModel, IteratorModel, SynchronizedHash

An extended hash interface with a couple of extra hooks. If a class implements this interface, then the built-in operators ?size, ?keys, and ?values can be applied to its instances in the template.

As of version 2.2.2, the engine will automatically wrap the collections returned by keys and values to present them as sequences to the template. For performance, you may wish to return objects that implement both TemplateCollectionModel and TemplateSequenceModel . Note that the wrapping to sequence happens on demand; if the template does not try to use the variable returned by ?keys or ?values as sequence (theKeys?size, or theKeys[x], or theKeys?sort, etc.), just iterates over the variable (<#list foo?keys as k>...), then no wrapping to sequence will happen, thus there will be no overhead.

Method from freemarker.template.TemplateHashModelEx Summary:
keys,   size,   values
Method from freemarker.template.TemplateHashModelEx Detail:
 public TemplateCollectionModel keys() throws TemplateModelException
 public int size() throws TemplateModelException
 public TemplateCollectionModel values() throws TemplateModelException