Uses of Class
freemarker.template.TemplateModelException
Packages that use TemplateModelException
Package
Description
The seldom used or advanced parts of the fundamental FreeMarker API, compared to
freemarker.template.Debugging API; experimental status, might change!
This is to support debugging in IDE-s.
The default object wrapper of FreeMarker uses
this to expose Java Beans and POJO-s to templates.
Exposes DOM XML nodes to templates as easily traversable trees;
see in the Manual.
Deprecated, use W3C DOM (
freemarker.ext.dom) instead;
Exposes JDOM XML nodes to templates.
Classes for two-way FreeMarker-JSP integration.
Servlet for legacy "Model 2" frameworks that allows using FreeMarker
templates instead of JSP as the MVC View
(see in the Manual).
Deprecated, use W3C DOM with
freemarker.ext.dom instead;
Exposes XML from DOM, dom4j or JDOM nodes, uniformly.The fundamental, most commonly used API-s of FreeMarker;
start with
Configuration (see also the
Getting Started in the Manual.)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 TemplateModelExceptionModifier and TypeMethodDescriptionEnvironment.__getitem__(String key) A hook that Jython uses.final MOabstract MOReturns aTemplateMarkupOutputModelthat contains the content of bothTemplateMarkupOutputModelobjects concatenated.CombinedMarkupOutputFormat.escapePlainText(String plainTextContent) abstract StringMarkupOutputFormat.escapePlainText(String plainTextContent) Should give the same result asMarkupOutputFormat.fromPlainTextByEscaping(String)and thenMarkupOutputFormat.getMarkupString(TemplateMarkupOutputModel), but the implementation may uses a more efficient solution.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.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 StringTemplateDateFormat.formatToPlainText(TemplateDateModel dateModel) abstract StringTemplateNumberFormat.formatToPlainText(TemplateNumberModel numberModel) final MOCommonMarkupOutputFormat.fromMarkup(String markupText) abstract MOMarkupOutputFormat.fromMarkup(String markupText) Wraps aStringthat's already markup toTemplateMarkupOutputModelinterface, to indicate its format.final MOCommonMarkupOutputFormat.fromPlainTextByEscaping(String textToEsc) abstract MOMarkupOutputFormat.fromPlainTextByEscaping(String textToEsc) Converts aStringthat's assumed to be plain text toTemplateMarkupOutputModel, by escaping any special characters in the plain text.Environment.getDataModelOrSharedVariable(String name) Returns the variable from the data-model, or if it's not there, then from the Configuration.setSharedVariables(Map) shared variables}Environment.getGlobalVariable(String name) Returns the globally visible variable of the given name, ornull.Environment.getKnownVariableNames()Returns a set of variable names that are known at the time of call.Environment.getLocalVariable(String name) Returns the loop or macro local variable corresponding to this variable name.final StringCommonMarkupOutputFormat.getMarkupString(MO mo) abstract StringMarkupOutputFormat.getMarkupString(MO mo) Returns the content as markup text; nevernull.protected intDefaultTruncateBuiltinAlgorithm.getMTerminatorLength(TemplateMarkupOutputModel<?> mTerminator) Returns the (estimated) length of the argument terminator.protected booleanDefaultTruncateBuiltinAlgorithm.getMTerminatorRemovesDots(TemplateMarkupOutputModel terminator) Same asDefaultTruncateBuiltinAlgorithm.getTerminatorRemovesDots(String), but invoked for a markup terminator.static DateTemplateFormatUtil.getNonNullDate(TemplateDateModel dateModel) Utility method to extract theDatefrom anTemplateDateModel, and throwTemplateModelExceptionwith a standard error message if that'snull.static NumberTemplateFormatUtil.getNonNullNumber(TemplateNumberModel numberModel) Utility method to extract theNumberfrom anTemplateNumberModel, and throwsTemplateModelExceptionwith a standard error message if that'snull.final StringCommonMarkupOutputFormat.getSourcePlainText(MO mo) abstract StringMarkupOutputFormat.getSourcePlainText(MO mo) If thisTemplateMarkupOutputModelwas created withMarkupOutputFormat.fromPlainTextByEscaping(String), it returns the original plain text, otherwise it returnsnull.protected booleanDefaultTruncateBuiltinAlgorithm.getTerminatorRemovesDots(String terminator) Tells if the dots touched by the terminator text should be removed.Environment.getVariable(String name) Returns the variable that is visible in this context, ornullif the variable is not found.booleanabstract booleanReturns if the markup is empty (0 length).booleanCombinedMarkupOutputFormat.isLegacyBuiltInBypassed(String builtInName) abstract booleanMarkupOutputFormat.isLegacyBuiltInBypassed(String builtInName) Tells if a string built-in that can't handle aTemplateMarkupOutputModelleft hand operand can bypass this object as is.protected abstract MOCommonMarkupOutputFormat.newTemplateMarkupOutputModel(String plainTextContent, String markupContent) Creates a newCommonTemplateMarkupOutputModelthat's bound to thisOutputFormatinstance.voidabstract voidfinal voidvoidabstract voidEquivalent to callingMarkupOutputFormat.fromPlainTextByEscaping(String)and thenMarkupOutputFormat.output(TemplateMarkupOutputModel, Writer), but the implementation may uses a more efficient solution.abstract voidPrints the parameter model to the output.voidvoidvoid -
Uses of TemplateModelException in freemarker.debug
Methods in freemarker.debug that throw TemplateModelExceptionModifier and TypeMethodDescriptionDebugModel.get(int index) DebugModel.get(int fromIndex, int toIndex) booleanDebugModel.getAsBoolean()DebugModel.getAsDate()DebugModel.getAsNumber()DebugModel.getAsString()DebugModel.getCollection()intDebugModel.getDateType()String[]DebugModel.keys()intDebugModel.size() -
Uses of TemplateModelException in freemarker.ext.beans
Subclasses of TemplateModelException in freemarker.ext.beansModifier and TypeClassDescriptionclassAn exception thrown when there is an attempt to access an invalid bean property when we are in a "strict bean" modeMethods in freemarker.ext.beans that throw TemplateModelExceptionModifier and TypeMethodDescriptionThe first argument is used as a key to call the map's get method.Invokes the method, passing it the arguments from the list.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.Invokes the method, passing it the arguments from the list.ArrayModel.get(int index) Uses Beans introspection to locate a property or method with name matching the key name.CollectionModel.get(int index) Retrieves the i-th object from the collection, wrapped as a TemplateModel.OverloadedMethodsModel.get(int index) SimpleMethodModel.get(int index) BeanModel.getAPI()SimpleMapModel.getAPI()protected TemplateModelBeanModel.invokeGenericGet(Map classInfo, Class<?> clazz, String key) protected TemplateModelMapModel.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 TemplateModelResourceBundleModel.invokeGenericGet(Map keyMap, Class clazz, String key) Overridden to invoke the getObject method of the resource bundle.protected TemplateModelBeansWrapper.invokeMethod(Object object, Method method, Object[] args) Invokes the specified method, wrapping the return value.EnumerationModel.iterator()This allows the enumeration to be used in a <#list> block.IteratorModel.iterator()This allows the iterator to be used in a <#list> block.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.EnumerationModel.next()Calls underlyingEnumeration.nextElement()and wraps the result.IteratorModel.next()Calls underlyingIterator.next()and wraps the result.protected TemplateModelReads the specified field, returns its value asTemplateModel.intOverloadedMethodsModel.size()intSimpleMethodModel.size()BeansWrapper.tryUnwrapTo(TemplateModel model, Class<?> targetClass) protected ObjectBeanModel.unwrap(TemplateModel model) BeansWrapper.unwrap(TemplateModel model) Attempts to unwrap a model into underlying object.BeansWrapper.unwrap(TemplateModel model, Class<?> targetClass) Attempts to unwrap a model into an object of the desired class.BeanModel.values()protected TemplateModelWraps the object with a template model that is most specific for the object's class. -
Uses of TemplateModelException in freemarker.ext.dom
Methods in freemarker.ext.dom that throw TemplateModelExceptionModifier and TypeMethodDescriptionXPathSupport.executeQuery(Object context, String xpathQuery) NodeModel.getNextSibling()final StringNodeModel.getNodeType()NodeModel.getPreviousSibling() -
Uses of TemplateModelException in freemarker.ext.jdom
Methods in freemarker.ext.jdom that throw TemplateModelExceptionModifier and TypeMethodDescriptionDeprecated.Applies an XPath expression to the node list and returns the resulting node list.NodeListModel.get(int i) Deprecated.Retrieves the i-th element of the node list.Deprecated.Provides node list traversal as well as special functions: filtering by name, filtering by node type, shallow-copying, and duplicate removal.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 TemplateModelExceptionModifier and TypeMethodDescriptionRetrieves a JSP tag library identified by an URI. -
Uses of TemplateModelException in freemarker.ext.servlet
Methods in freemarker.ext.servlet that throw TemplateModelExceptionModifier and TypeMethodDescriptionprotected TemplateModelFreemarkerServlet.createModel(ObjectWrapper objectWrapper, javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) protected TaglibFactoryFreemarkerServlet.createTaglibFactory(ObjectWrapper objectWrapper, javax.servlet.ServletContext servletContext) Called to create theTaglibFactoryonce per servlet context.booleanHttpSessionHashModel.isEmpty() -
Uses of TemplateModelException in freemarker.ext.xml
Methods in freemarker.ext.xml that throw TemplateModelExceptionModifier and TypeMethodDescriptionDeprecated.Evaluates an XPath expression on XML nodes in this model.Deprecated.Returns a new NodeListModel containing the nodes that result from applying an operator to this model's nodes.NodeListModel.getAsString()Deprecated.Returns the string representation of the wrapped nodes.NodeListModel.getChildNodes()Deprecated.NodeListModel.getNodeName()Deprecated.NodeListModel.getNodeNamespace()Deprecated.NodeListModel.getNodeType()Deprecated.NodeListModel.getParentNode()Deprecated. -
Uses of TemplateModelException in freemarker.template
Methods in freemarker.template that throw TemplateModelExceptionModifier and TypeMethodDescriptionintTransformControl.afterBody()Called after the body has been evaluated.booleanDefaultNonListCollectionAdapter.contains(TemplateModel item) Deprecated.Executes the method call.Executes the method call.DefaultListAdapter.get(int index) SimpleSequence.get(int index) Returns the item at the specified index of the list.Gets a TemplateModel from the hash.TemplateSequenceModel.get(int index) Retrieves the i-th template model in this sequence.DefaultEnumerationAdapter.getAPI()DefaultIterableAdapter.getAPI()DefaultIteratorAdapter.getAPI()DefaultListAdapter.getAPI()DefaultMapAdapter.getAPI()DefaultNonListCollectionAdapter.getAPI()TemplateModelWithAPISupport.getAPI()Returns the model that exposes the (Java) API of the value.booleanTemplateBooleanModel.getAsBoolean()TemplateDateModel.getAsDate()Returns the date value.TemplateNumberModel.getAsNumber()Returns the numeric value.LocalizedString.getAsString()TemplateScalarModel.getAsString()Returns theStringrepresentation of this model.TemplateNodeModel.getChildNodes()TemplateHashModelEx2.KeyValuePair.getKey()abstract StringLocalizedString.getLocalizedString(Locale locale) ResourceBundleLocalizedString.getLocalizedString(Locale locale) TemplateNodeModelEx.getNextSibling()TemplateNodeModel.getNodeName()TemplateNodeModel.getNodeNamespace()TemplateNodeModel.getNodeType()TemplateNodeModel.getParentNode()TemplateNodeModelEx.getPreviousSibling()TemplateHashModelEx2.KeyValuePair.getValue()Returns a writer that will be used by the engine to feed the transformation input to the transform.protected TemplateModelDefaultObjectWrapper.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.protected TemplateModelSimpleObjectWrapper.handleUnknownType(Object obj) Called if a type other than the simple ones we know about is passed in.booleanTemplateHashModelEx2.KeyValuePairIterator.hasNext()Similar toIterator.hasNext().booleanTemplateModelIterator.hasNext()booleanTemplateCollectionModelEx.isEmpty()Returns if the collection contains any elements.booleanTemplateHashModel.isEmpty()DefaultEnumerationAdapter.iterator()DefaultIterableAdapter.iterator()DefaultIteratorAdapter.iterator()DefaultNonListCollectionAdapter.iterator()TemplateCollectionModel.iterator()Retrieves a template model iterator that is used to iterate over the elements in this collection.TemplateHashModelEx.keys()TemplateHashModelEx2.keyValuePairIterator()TemplateHashModelEx2.KeyValuePairIterator.next()Similar toIterator.next().TemplateModelIterator.next()Returns the next model.intTransformControl.onStart()Called before the body is evaluated for the first time.voidConfiguration.setAllSharedVariables(TemplateHashModelEx hash) Adds all object in the hash as shared variable to the configuration; it's like doing severalConfiguration.setSharedVariable(String, Object)calls, one for each hash entry.voidConfiguration.setSharedVariable(String name, Object value) Adds shared variable to the configuration; It usesConfigurable.getObjectWrapper()to wrap thevalue, so it's important that the object wrapper is set before this.voidConfiguration.setSharedVariables(Map<String, ?> map) Replaces all shared variables (removes all previously added ones).voidConfiguration.setSharedVaribles(Map map) Deprecated.intDefaultListAdapter.size()intTemplateCollectionModelEx.size()Returns the number items in this collection, orInteger.MAX_VALUE, if there are more thanInteger.MAX_VALUEitems.intTemplateHashModelEx.size()intTemplateSequenceModel.size()SimpleSequence.toList()Deprecated.No replacement exists; not a reliable way of getting back the original list elemnts.SimpleHash.toMap()Note that this method creates and returns a deep-copy of the underlying hash used internally.ObjectWrapperAndUnwrapper.tryUnwrapTo(TemplateModel tm, Class<?> targetClass) Attempts to unwrap aTemplateModelto a plain Java object that's the instance of the given class (or isnull).ObjectWrapperAndUnwrapper.unwrap(TemplateModel tm) Unwraps aTemplateModelto a plain Java object.TemplateHashModelEx.values()Wraps the parameter object toTemplateModelinterface(s).Makes aTemplateModelout of a non-TemplateModelobject, usually by "wrapping" it into aTemplateModelimplementation that delegates to the original object.protected final TemplateModelWraps the passed object into a template model using this object's object wrapper.Constructors in freemarker.template that throw TemplateModelExceptionModifierConstructorDescriptionConstructs 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 TemplateModelExceptionModifier and TypeMethodDescriptionExecutes a method call.Deprecated.static final TemplateHashModelEx2.KeyValuePairIteratorTemplateModelUtils.getKeyValuePairIterator(TemplateHashModelEx hash) TemplateModelUtils.TemplateHashModelExKeyValuePairIteratorthat even works for a non-TemplateHashModelEx2TemplateHashModelEx.Deprecated.static ObjectDeepUnwrap.permissiveUnwrap(TemplateModel model) Same asDeepUnwrap.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 ObjectDeepUnwrap.premissiveUnwrap(TemplateModel model) Deprecated.the name of this method is mistyped.static ObjectDeepUnwrap.unwrap(TemplateModel model) UnwrapsTemplateModel-s recursively.Wraps an object to aTemplateModelthat exposes the object's "native" (usually, Java) API.static TemplateHashModelTemplateModelUtils.wrapAsHashUnion(ObjectWrapper objectWrapper, Object... hashLikeObjects) Same asTemplateModelUtils.wrapAsHashUnion(ObjectWrapper, List), but uses a varargs parameter instead of aList.static TemplateHashModelTemplateModelUtils.wrapAsHashUnion(ObjectWrapper objectWrapper, List<?> hashLikeObjects) Creates aTemplateHashModelthat is the union of the hash-like objects passed in as argument.
Configuration.setSharedVariables(Map)instead.