TemplateHashModelEx (FreeMarker 2.3.35 API)
Description: declaration: package: freemarker.template, interface: TemplateHashModelEx

Package freemarker.template

# Interface TemplateHashModelEx

All Superinterfaces:
  `TemplateHashModel`, `TemplateModel`

All Known Subinterfaces:
  `TemplateHashModelEx2`

All Known Implementing Classes:
  `AllHttpScopesHashModel`, `AllHttpScopesHashModel`, `ArrayModel`, `BeanModel`, `BooleanModel`, `CollectionModel`, `DateModel`, `DefaultMapAdapter`, `EnumerationModel`, `Environment.Namespace`, `GenericObjectModel`, `HttpRequestHashModel`, `HttpRequestHashModel`, `HttpRequestParametersHashModel`, `HttpRequestParametersHashModel`, `IteratorModel`, `JythonHashModel`, `MapModel`, `NumberModel`, `ResourceBundleModel`, `RhinoFunctionModel`, `RhinoScriptableModel`, `SimpleHash`, `SimpleMapModel`, `StringModel`

public interface TemplateHashModelEx extends TemplateHashModel
"extended hash" template language data type; extends `TemplateHashModel` by allowing iterating through its keys and values. Consider implementing the modern variation of this, `TemplateHashModelEx2`, which allows the more efficient listing of key-value pairs.

In templates they are used like hashes, but these will also work (among others): `myExtHash?size`, `myExtHash?keys`, `myExtHash?values`, `<#list myMap as k, v>`.

See Also:
  `DefaultMapAdapter`, `SimpleHash`

- ## Field Summary

  ### Fields inherited from interface freemarker.template.TemplateModel

  `NOTHING`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `TemplateCollectionModel`
  `keys()`
  `int`
  `size()`
  `TemplateCollectionModel`
  `values()`

  ### Methods inherited from interface freemarker.template.TemplateHashModel

  `get, isEmpty`

- ## Method Details

  - ### size

    int size() throws TemplateModelException
    Returns:
      the number of key/value mappings in the hash.
    Throws:
      `TemplateModelException`

  - ### keys

    TemplateCollectionModel keys() throws TemplateModelException
    Returns:
      a collection containing the keys in the hash. Every element of the returned collection must implement the `TemplateScalarModel` (as the keys of hashes are always strings).
    Throws:
      `TemplateModelException`

  - ### values

    TemplateCollectionModel values() throws TemplateModelException
    Returns:
      a collection containing the values in the hash. The elements of the returned collection can be any kind of `TemplateModel`-s.
    Throws:
      `TemplateModelException`