## Uses of Class
freemarker.template.TemplateModelException

Packages that use TemplateModelException
freemarker.core: The seldom used or advanced parts of the fundamental FreeMarker API, compared to `freemarker.template`.
freemarker.debug: Debugging API; experimental status, might change! This is to support debugging in IDE-s.
freemarker.ext.beans: 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`.
freemarker.ext.dom: Exposes DOM XML nodes to templates as easily traversable trees; see in the Manual.
freemarker.ext.jdom: Deprecated, use W3C DOM (`freemarker.ext.dom`) instead; Exposes JDOM XML nodes to templates.
freemarker.ext.jsp: Classes for two-way FreeMarker-JSP integration.
freemarker.ext.jython: Exposes Jython objects to templates.
freemarker.ext.rhino: Exposes Rhino (ECMAScript) objects to templates.
freemarker.ext.servlet: Servlet for legacy "Model 2" frameworks that allows using FreeMarker templates instead of JSP as the MVC View (see in the Manual).
freemarker.ext.xml: Deprecated, use W3C DOM with `freemarker.ext.dom` instead; Exposes XML from DOM, dom4j or JDOM nodes, uniformly.
freemarker.template: The fundamental, most commonly used API-s of FreeMarker; start with `Configuration` (see also the Getting Stared in the Manual.)
freemarker.template.utility: Various classes used by core FreeMarker code but might be useful outside of it too.

### Uses of TemplateModelException in freemarker.core

Methods in freemarker.core that throw TemplateModelException
`Object` Environment.`__getitem__(String key)` A hook that Jython uses.
`abstract MO` MarkupOutputFormat.`concat(MO mo1, MO mo2)` Returns a `TemplateMarkupOutputModel` that contains the content of both `TemplateMarkupOutputModel` objects concatenated.
`MO` CommonMarkupOutputFormat.`concat(MO mo1, MO mo2)`
`abstract String` MarkupOutputFormat.`escapePlainText(String plainTextContent)` Should give the same result as `MarkupOutputFormat.fromPlainTextByEscaping(String)` and then `MarkupOutputFormat.getMarkupString(TemplateMarkupOutputModel)`, but the implementation may uses a more efficient solution.
`String` CombinedMarkupOutputFormat.`escapePlainText(String plainTextContent)`
`Object` TemplateDateFormat.`format(TemplateDateModel dateModel)` Formats the model to markup instead of to plain text if the result markup will be more than just plain text escaped, otherwise falls back to formatting to plain text.
`Object` TemplateNumberFormat.`format(TemplateNumberModel numberModel)` Formats the model to markup instead of to plain text if the result markup will be more than just plain text escaped, otherwise falls back to formatting to plain text.
`abstract String` TemplateDateFormat.`formatToPlainText(TemplateDateModel dateModel)`
`abstract String` TemplateNumberFormat.`formatToPlainText(TemplateNumberModel numberModel)`
`abstract MO` MarkupOutputFormat.`fromMarkup(String markupText)` Wraps a `String` that's already markup to `TemplateMarkupOutputModel` interface, to indicate its format.
`MO` CommonMarkupOutputFormat.`fromMarkup(String markupText)`
`abstract MO` MarkupOutputFormat.`fromPlainTextByEscaping(String textToEsc)` Converts a `String` that's assumed to be plain text to `TemplateMarkupOutputModel`, by escaping any special characters in the plain text.
`MO` CommonMarkupOutputFormat.`fromPlainTextByEscaping(String textToEsc)`
`TemplateModel` Environment.`getGlobalVariable(String name)` Returns the globally visible variable of the given name (or null).
`Set` Environment.`getKnownVariableNames()` Returns a set of variable names that are known at the time of call.
`TemplateModel` Environment.`getLocalVariable(String name)` Returns the loop or macro local variable corresponding to this variable name.
`abstract String` MarkupOutputFormat.`getMarkupString(MO mo)` Returns the content as markup text; never `null`.
`String` CommonMarkupOutputFormat.`getMarkupString(MO mo)`
`static Date` TemplateFormatUtil.`getNonNullDate(TemplateDateModel dateModel)` Utility method to extract the `Date` from an `TemplateDateModel`, and throw `TemplateModelException` with a standard error message if that's `null`.
`static Number` TemplateFormatUtil.`getNonNullNumber(TemplateNumberModel numberModel)` Utility method to extract the `Number` from an `TemplateNumberModel`, and throws `TemplateModelException` with a standard error message if that's `null`.
`abstract String` MarkupOutputFormat.`getSourcePlainText(MO mo)` If this `TemplateMarkupOutputModel` was created with `MarkupOutputFormat.fromPlainTextByEscaping(String)`, it returns the original plain text, otherwise it returns `null`.
`String` CommonMarkupOutputFormat.`getSourcePlainText(MO mo)`
`TemplateModel` Environment.`getVariable(String name)` Returns the variable that is visible in this context, or `null` if the variable is not found.
`abstract boolean` MarkupOutputFormat.`isEmpty(MO mo)` Returns if the markup is empty (0 length).
`boolean` CommonMarkupOutputFormat.`isEmpty(MO mo)`
`abstract boolean` MarkupOutputFormat.`isLegacyBuiltInBypassed(String builtInName)` Tells if a string built-in that can't handle a `TemplateMarkupOutputModel` left hand operand can bypass this object as is.
`boolean` CombinedMarkupOutputFormat.`isLegacyBuiltInBypassed(String builtInName)`
`protected abstract MO` CommonMarkupOutputFormat.`newTemplateMarkupOutputModel(String plainTextContent, String markupContent)` Creates a new `CommonTemplateMarkupOutputModel` that's bound to this `OutputFormat` instance.
`abstract void` MarkupOutputFormat.`output(MO mo, Writer out)` Prints the parameter model to the output.
`void` CommonMarkupOutputFormat.`output(MO mo, Writer out)`
`void` XMLOutputFormat.`output(String textToEsc, Writer out)`
`void` XHTMLOutputFormat.`output(String textToEsc, Writer out)`
`void` RTFOutputFormat.`output(String textToEsc, Writer out)`
`abstract void` MarkupOutputFormat.`output(String textToEsc, Writer out)` Equivalent to calling `MarkupOutputFormat.fromPlainTextByEscaping(String)` and then `MarkupOutputFormat.output(TemplateMarkupOutputModel, Writer)`, but the implementation may uses a more efficient solution.
`void` HTMLOutputFormat.`output(String textToEsc, Writer out)`
`abstract void` CommonMarkupOutputFormat.`output(String textToEsc, Writer out)`
`void` CombinedMarkupOutputFormat.`output(String textToEsc, Writer out)`

### Uses of TemplateModelException in freemarker.debug

Methods in freemarker.debug that throw TemplateModelException
`DebugModel` DebugModel.`get(int index)`
`DebugModel[]` DebugModel.`get(int fromIndex, int toIndex)`
`DebugModel` DebugModel.`get(String key)`
`DebugModel[]` DebugModel.`get(String[] keys)`
`boolean` DebugModel.`getAsBoolean()`
`Date` DebugModel.`getAsDate()`
`Number` DebugModel.`getAsNumber()`
`String` DebugModel.`getAsString()`
`DebugModel[]` DebugModel.`getCollection()`
`int` DebugModel.`getDateType()`
`String[]` DebugModel.`keys()`
`int` DebugModel.`size()`

### Uses of TemplateModelException in freemarker.ext.beans

Subclasses of TemplateModelException in freemarker.ext.beans
`class` `InvalidPropertyException` An exception thrown when there is an attempt to access an invalid bean property when we are in a "strict bean" mode

Methods in freemarker.ext.beans that throw TemplateModelException
`Object` SimpleMethodModel.`exec(List arguments)` Invokes the method, passing it the arguments from the list.
`Object` SimpleMapModel.`exec(List args)`
`Object` ResourceBundleModel.`exec(List arguments)` Takes first argument as a resource key, looks up a string in resource bundle with this key, then applies a MessageFormat.format on the string with the rest of the arguments.
`Object` OverloadedMethodsModel.`exec(List arguments)` Invokes the method, passing it the arguments from the list.
`Object` MapModel.`exec(List arguments)` The first argument is used as a key to call the map's `get` method.
`TemplateModel` SimpleMethodModel.`get(int index)`
`TemplateModel` OverloadedMethodsModel.`get(int index)`
`TemplateModel` CollectionModel.`get(int index)` Retrieves the i-th object from the collection, wrapped as a TemplateModel.
`TemplateModel` ArrayModel.`get(int index)`
`TemplateModel` SimpleMapModel.`get(String key)`
`TemplateModel` BeanModel.`get(String key)` Uses Beans introspection to locate a property or method with name matching the key name.
`TemplateModel` SimpleMapModel.`getAPI()`
`TemplateModel` BeanModel.`getAPI()`
`protected TemplateModel` ResourceBundleModel.`invokeGenericGet(Map keyMap, Class clazz, String key)` Overridden to invoke the getObject method of the resource bundle.
`protected TemplateModel` MapModel.`invokeGenericGet(Map keyMap, Class clazz, String key)` Overridden to invoke the generic get method by casting to Map instead of through reflection - should yield better performance.
`protected TemplateModel` BeanModel.`invokeGenericGet(Map keyMap, Class clazz, String key)`
`TemplateModelIterator` IteratorModel.`iterator()` This allows the iterator to be used in a `<#list>` block.
`TemplateModelIterator` EnumerationModel.`iterator()` This allows the enumeration to be used in a `<#list>` block.
`Object` BeansWrapper.`newInstance(Class clazz, List arguments)` Creates a new instance of the specified class using the method call logic of this object wrapper for calling the constructor.
`TemplateModel` IteratorModel.`next()` Calls underlying `Iterator.next()` and wraps the result.
`TemplateModel` EnumerationModel.`next()` Calls underlying `Enumeration.nextElement()` and wraps the result.
`int` SimpleMethodModel.`size()`
`int` OverloadedMethodsModel.`size()`
`Object` BeansWrapper.`tryUnwrapTo(TemplateModel model, Class targetClass)`
`Object` BeansWrapper.`unwrap(TemplateModel model)` Attempts to unwrap a model into underlying object.
`protected Object` BeanModel.`unwrap(TemplateModel model)`
`Object` BeansWrapper.`unwrap(TemplateModel model, Class targetClass)` Attempts to unwrap a model into an object of the desired class.
`TemplateCollectionModel` BeanModel.`values()`
`TemplateModel` BeansWrapper.`wrap(Object object)` Wraps the object with a template model that is most specific for the object's class.
`protected TemplateModel` BeanModel.`wrap(Object obj)`
`TemplateHashModel` BeansWrapper.`wrapAsAPI(Object obj)`

### Uses of TemplateModelException in freemarker.ext.dom

Methods in freemarker.ext.dom that throw TemplateModelException
`TemplateModel` NodeModel.`exec(List args)`
`TemplateModel` XPathSupport.`executeQuery(Object context, String xpathQuery)`
`TemplateModel` NodeModel.`get(String key)`
`String` NodeModel.`getNodeType()`

### Uses of TemplateModelException in freemarker.ext.jdom

Methods in freemarker.ext.jdom that throw TemplateModelException
`Object` NodeListModel.`exec(List arguments)` Deprecated. Applies an XPath expression to the node list and returns the resulting node list.
`TemplateModel` NodeListModel.`get(int i)` Deprecated. Retrieves the i-th element of the node list.
`TemplateModel` NodeListModel.`get(String key)` Deprecated. Provides node list traversal as well as special functions: filtering by name, filtering by node type, shallow-copying, and duplicate removal.
`String` NodeListModel.`getAsString()` Deprecated. This method returns the string resulting from concatenation of string representations of its nodes.

### Uses of TemplateModelException in freemarker.ext.jsp

Methods in freemarker.ext.jsp that throw TemplateModelException
`TemplateModel` TaglibFactory.`get(String taglibUri)` Retrieves a JSP tag library identified by an URI.

### Uses of TemplateModelException in freemarker.ext.jython

Methods in freemarker.ext.jython that throw TemplateModelException
`Object` JythonModel.`exec(List arguments)`
`TemplateModel` JythonSequenceModel.`get(int index)` Returns `PyObject.__finditem__(int)`.
`TemplateModel` JythonModel.`get(String key)` Calls `PyObject.__findattr__(java.lang.String)`, then if it returns null calls `PyObject.__finditem__(java.lang.String)`.
`boolean` JythonModel.`getAsBoolean()` Returns the value of `PyObject.__nonzero__()`.
`Number` JythonNumberModel.`getAsNumber()` Returns either `PyObject.__tojava__(java.lang.Class)` with `Number`.class as argument.
`String` JythonModel.`getAsString()` Returns the value of `Object.toString()`.
`boolean` JythonModel.`isEmpty()` Returns `PyObject.__len__()``== 0`.
`TemplateCollectionModel` JythonHashModel.`keys()` Returns either `object.__findattr__("keys").__call__()` or `object.__findattr__("keySet").__call__()`.
`int` JythonSequenceModel.`size()` Returns `PyObject.__len__()`.
`int` JythonHashModel.`size()` Returns `PyObject.__len__()`.
`org.python.core.PyObject` JythonWrapper.`unwrap(TemplateModel model)` Coerces a template model into a `PyObject`.
`TemplateCollectionModel` JythonHashModel.`values()` Returns `object.__findattr__("values").__call__()`.

### Uses of TemplateModelException in freemarker.ext.rhino

Methods in freemarker.ext.rhino that throw TemplateModelException
`Object` RhinoFunctionModel.`exec(List arguments)`
`TemplateModel` RhinoScriptableModel.`get(int index)`
`TemplateModel` RhinoScriptableModel.`get(String key)`
`TemplateCollectionModel` RhinoScriptableModel.`keys()`
`TemplateCollectionModel` RhinoScriptableModel.`values()`
`TemplateModel` RhinoWrapper.`wrap(Object obj)`

### Uses of TemplateModelException in freemarker.ext.servlet

Methods in freemarker.ext.servlet that throw TemplateModelException
`protected TemplateModel` FreemarkerServlet.`createModel(ObjectWrapper objectWrapper, javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)`
`protected TaglibFactory` FreemarkerServlet.`createTaglibFactory(ObjectWrapper objectWrapper, javax.servlet.ServletContext servletContext)` Called to create the `TaglibFactory` once per servlet context.
`TemplateModel` ServletContextHashModel.`get(String key)`
`TemplateModel` HttpSessionHashModel.`get(String key)`
`TemplateModel` HttpRequestHashModel.`get(String key)`
`TemplateModel` AllHttpScopesHashModel.`get(String key)`
`boolean` HttpSessionHashModel.`isEmpty()`

### Uses of TemplateModelException in freemarker.ext.xml

Methods in freemarker.ext.xml that throw TemplateModelException
`Object` NodeListModel.`exec(List arguments)` Deprecated. Evaluates an XPath expression on XML nodes in this model.
`TemplateModel` NodeListModel.`get(String key)` Deprecated. Returns a new NodeListModel containing the nodes that result from applying an operator to this model's nodes.
`String` NodeListModel.`getAsString()` Deprecated. Returns the string representation of the wrapped nodes.
`TemplateSequenceModel` NodeListModel.`getChildNodes()` Deprecated.
`String` NodeListModel.`getNodeName()` Deprecated.
`String` NodeListModel.`getNodeNamespace()` Deprecated.
`String` NodeListModel.`getNodeType()` Deprecated.
`TemplateNodeModel` NodeListModel.`getParentNode()` Deprecated.

### Uses of TemplateModelException in freemarker.template

Methods in freemarker.template that throw TemplateModelException
`int` TransformControl.`afterBody()` Called after the body has been evaluated.
`boolean` TemplateCollectionModelEx.`contains(TemplateModel item)` Tells if a given value occurs in the collection, accodring the rules of the wrapped collection.
`boolean` DefaultNonListCollectionAdapter.`contains(TemplateModel item)`
`Object` TemplateMethodModelEx.`exec(List arguments)` Executes the method call.
`Object` TemplateMethodModel.`exec(List arguments)` Deprecated. Executes the method call.
`TemplateModel` TemplateSequenceModel.`get(int index)` Retrieves the i-th template model in this sequence.
`TemplateModel` SimpleSequence.`get(int index)` Returns the item at the specified index of the list.
`TemplateModel` DefaultListAdapter.`get(int index)`
`TemplateModel` TemplateHashModel.`get(String key)` Gets a `TemplateModel` from the hash.
`TemplateModel` SimpleHash.`get(String key)`
`TemplateModel` DefaultMapAdapter.`get(String key)`
`TemplateModel` TemplateModelWithAPISupport.`getAPI()` Returns the model that exposes the (Java) API of the value.
`TemplateModel` DefaultNonListCollectionAdapter.`getAPI()`
`TemplateModel` DefaultMapAdapter.`getAPI()`
`TemplateModel` DefaultListAdapter.`getAPI()`
`TemplateModel` DefaultIterableAdapter.`getAPI()`
`boolean` TemplateBooleanModel.`getAsBoolean()`
`Date` TemplateDateModel.`getAsDate()` Returns the date value.
`Number` TemplateNumberModel.`getAsNumber()` Returns the numeric value.
`String` TemplateScalarModel.`getAsString()` Returns the string representation of this model.
`String` LocalizedString.`getAsString()`
`TemplateSequenceModel` TemplateNodeModel.`getChildNodes()`
`TemplateModel` TemplateHashModelEx2.KeyValuePair.`getKey()`
`String` ResourceBundleLocalizedString.`getLocalizedString(Locale locale)`
`abstract String` LocalizedString.`getLocalizedString(Locale locale)`
`String` TemplateNodeModel.`getNodeName()`
`String` TemplateNodeModel.`getNodeNamespace()`
`String` TemplateNodeModel.`getNodeType()`
`TemplateNodeModel` TemplateNodeModel.`getParentNode()`
`TemplateModel` TemplateHashModelEx2.KeyValuePair.`getValue()`
`Writer` TemplateTransformModel.`getWriter(Writer out, Map args)` Returns a writer that will be used by the engine to feed the transformation input to the transform.
`protected TemplateModel` SimpleObjectWrapper.`handleUnknownType(Object obj)` Called if a type other than the simple ones we know about is passed in.
`protected TemplateModel` DefaultObjectWrapper.`handleUnknownType(Object obj)` Called for an object that isn't considered to be of a "basic" Java type, like for an application specific type, or for a W3C DOM node.
`boolean` TemplateModelIterator.`hasNext()`
`boolean` TemplateHashModelEx2.KeyValuePairIterator.`hasNext()` Similar to `Iterator.hasNext()`.
`boolean` TemplateHashModel.`isEmpty()`
`boolean` TemplateCollectionModelEx.`isEmpty()` Returns if the collection contains any elements.
`TemplateModelIterator` TemplateCollectionModel.`iterator()` Retrieves a template model iterator that is used to iterate over the elements in this collection.
`TemplateModelIterator` DefaultNonListCollectionAdapter.`iterator()`
`TemplateModelIterator` DefaultIteratorAdapter.`iterator()`
`TemplateModelIterator` DefaultIterableAdapter.`iterator()`
`TemplateCollectionModel` TemplateHashModelEx.`keys()`
`TemplateHashModelEx2.KeyValuePairIterator` TemplateHashModelEx2.`keyValuePairIterator()`
`TemplateModel` TemplateModelIterator.`next()` Returns the next model.
`TemplateHashModelEx2.KeyValuePair` TemplateHashModelEx2.KeyValuePairIterator.`next()` Similar to `Iterator.next()`.
`int` TransformControl.`onStart()` Called before the body is evaluated for the first time.
`void` Configuration.`setAllSharedVariables(TemplateHashModelEx hash)` Adds all object in the hash as shared variable to the configuration; it's like doing several `Configuration.setSharedVariable(String, Object)` calls, one for each hash entry.
`void` Configuration.`setSharedVariable(String name, Object value)` Adds shared variable to the configuration; It uses `Configurable.getObjectWrapper()` to wrap the `value`, so it's important that the object wrapper is set before this.
`void` Configuration.`setSharedVaribles(Map map)` Replaces all shared variables (removes all previously added ones).
`int` TemplateSequenceModel.`size()`
`int` TemplateHashModelEx.`size()`
`int` TemplateCollectionModelEx.`size()` Returns the number items in this collection, or `Integer.MAX_VALUE`, if there are more than `Integer.MAX_VALUE` items.
`int` DefaultListAdapter.`size()`
`List` SimpleSequence.`toList()` Deprecated. No replacement exists; not a reliable way of getting back the original list elemnts.
`Map` SimpleHash.`toMap()` Note that this method creates and returns a deep-copy of the underlying hash used internally.
`Object` ObjectWrapperAndUnwrapper.`tryUnwrapTo(TemplateModel tm, Class targetClass)` Attempts to unwrap a `TemplateModel` to a plain Java object that's the instance of the given class (or is `null`).
`Object` ObjectWrapperAndUnwrapper.`unwrap(TemplateModel tm)` Unwraps a `TemplateModel` to a plain Java object.
`TemplateCollectionModel` TemplateHashModelEx.`values()`
`protected TemplateModel` WrappingTemplateModel.`wrap(Object obj)` Wraps the passed object into a template model using this object's object wrapper.
`TemplateModel` ObjectWrapper.`wrap(Object obj)` Makes a `TemplateModel` out of a non-`TemplateModel` object, usually by "wrapping" it into a `TemplateModel` implementation that delegates to the original object.
`TemplateModel` DefaultObjectWrapper.`wrap(Object obj)` Wraps the parameter object to `TemplateModel` interface(s).
`TemplateHashModel` SimpleObjectWrapper.`wrapAsAPI(Object obj)`

Constructors in freemarker.template that throw TemplateModelException
Constructor and Description
`SimpleSequence(TemplateCollectionModel tcm)` Constructs a simple sequence from the passed collection model, which shouldn't be added to later.

### Uses of TemplateModelException in freemarker.template.utility

Methods in freemarker.template.utility that throw TemplateModelException
`Object` ObjectConstructor.`exec(List args)`
`Object` Execute.`exec(List arguments)` Executes a method call.
`TemplateModel` DOMNodeModel.`get(String key)`
`Writer` StandardCompress.`getWriter(Writer out, Map args)`
`Writer` CaptureOutput.`getWriter(Writer out, Map args)` Deprecated.
`static Object` DeepUnwrap.`permissiveUnwrap(TemplateModel model)` Same as `DeepUnwrap.unwrap(TemplateModel)`, but it doesn't throw exception if it doesn't know how to unwrap the model, but rather returns it as-is.
`static Object` DeepUnwrap.`premissiveUnwrap(TemplateModel model)` Deprecated. the name of this method is mistyped. Use `DeepUnwrap.permissiveUnwrap(TemplateModel)` instead.
`static Object` DeepUnwrap.`unwrap(TemplateModel model)` Unwraps `TemplateModel`-s recursively.
`TemplateHashModel` ObjectWrapperWithAPISupport.`wrapAsAPI(Object obj)` Wraps an object to a `TemplateModel` that exposes the object's "native" (usually, Java) API.