Uses of Interface
freemarker.template.TemplateModel
-
Packages that use TemplateModel Package Description freemarker.core The seldom used or advanced parts of the fundamental FreeMarker API, compared tofreemarker.template.freemarker.ext.beans Thedefault object wrapperof FreeMarker uses this to expose Java Beans and POJO-s to templates, but it can also be used in itself as a better alternativeObjectWrapper.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.util Various classes used byfreemarker.extbut might be useful outside it too.freemarker.ext.xml Deprecated, use W3C DOM withfreemarker.ext.dominstead; Exposes XML from DOM, dom4j or JDOM nodes, uniformly.freemarker.template The fundamental, most commonly used API-s of FreeMarker; start withConfiguration(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 TemplateModel in freemarker.core
Classes in freemarker.core that implement TemplateModel Modifier and Type Class Description classEnvironment.NamespaceMethods in freemarker.core that return TemplateModel Modifier and Type Method Description TemplateModelEnvironment. getGlobalVariable(String name)Returns the globally visible variable of the given name (or null).TemplateModelEnvironment. getLocalVariable(String name)Returns the loop or macro local variable corresponding to this variable name.TemplateModelEnvironment. getVariable(String name)Returns the variable that is visible in this context, ornullif the variable is not found.Methods in freemarker.core with parameters of type TemplateModel Modifier and Type Method Description booleanEnvironment. applyEqualsOperator(TemplateModel leftValue, TemplateModel rightValue)Compares twoTemplateModel-s according the rules of the FTL "==" operator.booleanEnvironment. applyEqualsOperatorLenient(TemplateModel leftValue, TemplateModel rightValue)Compares twoTemplateModel-s according the rules of the FTL "==" operator, except that if the two types are incompatible, they are treated as non-equal instead of throwing an exception.booleanEnvironment. applyGreaterThanOperator(TemplateModel leftValue, TemplateModel rightValue)Compares twoTemplateModel-s according the rules of the FTL ">" operator.booleanEnvironment. applyLessThanOperator(TemplateModel leftValue, TemplateModel rightValue)Compares twoTemplateModel-s according the rules of the FTL "<" operator.booleanEnvironment. applyLessThanOrEqualsOperator(TemplateModel leftValue, TemplateModel rightValue)Compares twoTemplateModel-s according the rules of the FTL "<" operator.booleanEnvironment. applyWithGreaterThanOrEqualsOperator(TemplateModel leftValue, TemplateModel rightValue)Compares twoTemplateModel-s according the rules of the FTL ">=" operator.voidEnvironment. setGlobalVariable(String name, TemplateModel model)Sets a variable that is visible globally.voidEnvironment. setLocalVariable(String name, TemplateModel model)Sets a local variable (one effective only during a macro invocation).voidEnvironment. setVariable(String name, TemplateModel model)Sets a variable in the current namespace. -
Uses of TemplateModel in freemarker.ext.beans
Classes in freemarker.ext.beans that implement TemplateModel Modifier and Type Class Description classArrayModelA class that will wrap an arbitrary array intoTemplateCollectionModelandTemplateSequenceModelinterfaces.classBeanModelA class that will wrap an arbitrary object intoTemplateHashModelinterface allowing calls to arbitrary property getters and invocation of accessible methods on the object from a template using the object.foo to access properties and object.bar(arg1, arg2) to invoke methods on it.classBooleanModelA class that will wrap instances ofBooleaninto aTemplateBooleanModel.classCollectionModelA special case ofBeanModelthat can wrap Java collections and that implements theTemplateCollectionModelin order to be usable in a <#list> block.classDateModelWraps arbitrary subclass ofDateinto a reflective model.classEnumerationModelA class that addsTemplateModelIteratorfunctionality to theEnumerationinterface implementers.classIteratorModelA class that addsTemplateModelIteratorfunctionality to theIteratorinterface implementers.classMapModelA special case ofBeanModelthat adds implementation forTemplateMethodModelExon map objects that is a shortcut for the Map.get() method.classNumberModelWraps arbitrary subclass ofNumberinto a reflective model.classOverloadedMethodsModelWraps a set of same-name overloaded methods behindTemplateMethodModelinterface, like if it was a single method, chooses among them behind the scenes on call-time based on the argument values.classResourceBundleModelA hash model that wraps a resource bundle.classSimpleMapModelModel used byBeansWrapperwhen simpleMapWrapper mode is enabled.classSimpleMethodModelA class that will wrap a reflected method call into aTemplateMethodModelinterface.classStringModelSubclass ofBeanModelthat exposes the return value of theObject.toString()method through theTemplateScalarModelinterface.Methods in freemarker.ext.beans that return TemplateModel Modifier and Type Method Description protected TemplateModelBeansModelCache. create(Object object)TemplateModelArrayModel. get(int index)TemplateModelBeanModel. get(String key)Uses Beans introspection to locate a property or method with name matching the key name.TemplateModelCollectionModel. get(int index)Retrieves the i-th object from the collection, wrapped as a TemplateModel.TemplateModelOverloadedMethodsModel. get(int index)TemplateModelSimpleMapModel. get(String key)TemplateModelSimpleMethodModel. get(int index)TemplateModelBeanModel. getAPI()TemplateModelSimpleMapModel. getAPI()protected TemplateModelBeansWrapper. getInstance(Object object, ModelFactory factory)Deprecated.overrideBeansWrapper.getModelFactory(Class)instead.TemplateModelHashAdapter. getTemplateModel()protected TemplateModelBeanModel. invokeGenericGet(Map keyMap, 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.TemplateModelEnumerationModel. next()Calls underlyingEnumeration.nextElement()and wraps the result.TemplateModelIteratorModel. next()Calls underlyingIterator.next()and wraps the result.protected TemplateModelBeanModel. wrap(Object obj)TemplateModelBeansWrapper. wrap(Object object)Wraps the object with a template model that is most specific for the object's class.Methods in freemarker.ext.beans with parameters of type TemplateModel Modifier and Type Method Description voidBeansWrapper. setNullModel(TemplateModel nullModel)Deprecated.Changing thenullmodel can cause a lot of confusion; don't do it.ObjectBeansWrapper. tryUnwrapTo(TemplateModel model, Class targetClass)protected ObjectBeanModel. unwrap(TemplateModel model)ObjectBeansWrapper. unwrap(TemplateModel model)Attempts to unwrap a model into underlying object.ObjectBeansWrapper. unwrap(TemplateModel model, Class targetClass)Attempts to unwrap a model into an object of the desired class. -
Uses of TemplateModel in freemarker.ext.dom
Classes in freemarker.ext.dom that implement TemplateModel Modifier and Type Class Description classNodeModelA base class for wrapping a W3C DOM Node as a FreeMarker template model.Methods in freemarker.ext.dom that return TemplateModel Modifier and Type Method Description TemplateModelNodeModel. exec(List args)TemplateModelXPathSupport. executeQuery(Object context, String xpathQuery)TemplateModelNodeModel. get(int i)TemplateModelNodeModel. get(String key) -
Uses of TemplateModel in freemarker.ext.jdom
Classes in freemarker.ext.jdom that implement TemplateModel Modifier and Type Class Description classNodeListModelDeprecated.UseNodeModelinstead.Methods in freemarker.ext.jdom that return TemplateModel Modifier and Type Method Description TemplateModelNodeListModel. get(int i)Deprecated.Retrieves the i-th element of the node list.TemplateModelNodeListModel. 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. -
Uses of TemplateModel in freemarker.ext.jsp
Classes in freemarker.ext.jsp that implement TemplateModel Modifier and Type Class Description classTaglibFactoryA hash model associated with a servlet context that can load JSP tag libraries associated with that servlet context.Methods in freemarker.ext.jsp that return TemplateModel Modifier and Type Method Description TemplateModelTaglibFactory. get(String taglibUri)Retrieves a JSP tag library identified by an URI. -
Uses of TemplateModel in freemarker.ext.jython
Classes in freemarker.ext.jython that implement TemplateModel Modifier and Type Class Description classJythonHashModelModel for Jython dictionaries (PyDictionaryandPyStringMap).classJythonModelGeneric model for arbitrary Jython objects.classJythonNumberModelclassJythonSequenceModelModel for Jython sequence objects (PySequencedescendants).Methods in freemarker.ext.jython that return TemplateModel Modifier and Type Method Description TemplateModelJythonModel. get(String key)CallsPyObject.__findattr__(java.lang.String), then if it returns null callsPyObject.__finditem__(java.lang.String).TemplateModelJythonSequenceModel. get(int index)ReturnsPyObject.__finditem__(int).TemplateModelJythonWrapper. wrap(Object obj)Wraps the passed Jython object into a FreeMarker template model.Methods in freemarker.ext.jython with parameters of type TemplateModel Modifier and Type Method Description PyObjectJythonWrapper. unwrap(TemplateModel model)Coerces a template model into aPyObject. -
Uses of TemplateModel in freemarker.ext.rhino
Classes in freemarker.ext.rhino that implement TemplateModel Modifier and Type Class Description classRhinoFunctionModelclassRhinoScriptableModelMethods in freemarker.ext.rhino that return TemplateModel Modifier and Type Method Description TemplateModelRhinoScriptableModel. get(int index)TemplateModelRhinoScriptableModel. get(String key)TemplateModelRhinoWrapper. wrap(Object obj) -
Uses of TemplateModel in freemarker.ext.servlet
Classes in freemarker.ext.servlet that implement TemplateModel Modifier and Type Class Description classAllHttpScopesHashModelAn extension of SimpleHash that looks up keys in the hash, then in the request, session, and servlet context scopes.classHttpRequestHashModelTemplateHashModel wrapper for a HttpServletRequest attributes.classHttpRequestParametersHashModelTemplateHashModel wrapper for a HttpServletRequest parameters.classHttpSessionHashModelTemplateHashModel wrapper for a HttpSession attributes.classIncludePageA model that when invoked with a 'path' parameter will perform a servlet include.classServletContextHashModelTemplateHashModel wrapper for a ServletContext attributes.Methods in freemarker.ext.servlet that return TemplateModel Modifier and Type Method Description protected TemplateModelFreemarkerServlet. createModel(ObjectWrapper objectWrapper, javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)TemplateModelAllHttpScopesHashModel. get(String key)TemplateModelHttpRequestHashModel. get(String key)TemplateModelHttpRequestParametersHashModel. get(String key)TemplateModelHttpSessionHashModel. get(String key)TemplateModelServletContextHashModel. get(String key)Methods in freemarker.ext.servlet with parameters of type TemplateModel Modifier and Type Method Description voidIncludePage. execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)protected voidFreemarkerServlet. postTemplateProcess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Template template, TemplateModel data)Called after the execution returns from template.process().protected booleanFreemarkerServlet. preTemplateProcess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Template template, TemplateModel data)Called before the execution is passed to template.process().voidAllHttpScopesHashModel. putUnlistedModel(String key, TemplateModel model)Stores a model in the hash so that it doesn't show up in keys() and values() methods. -
Uses of TemplateModel in freemarker.ext.util
Subinterfaces of TemplateModel in freemarker.ext.util Modifier and Type Interface Description interfaceWrapperTemplateModelA generic interface for template models that wrap some underlying object, and wish to provide access to that wrapped object.Methods in freemarker.ext.util that return TemplateModel Modifier and Type Method Description protected abstract TemplateModelModelCache. create(Object object)TemplateModelModelFactory. create(Object object, ObjectWrapper wrapper)Create a wrapping model for the specified object that belongs to the specified wrapper.TemplateModelModelCache. getInstance(Object object) -
Uses of TemplateModel in freemarker.ext.xml
Classes in freemarker.ext.xml that implement TemplateModel Modifier and Type Class Description classNodeListModelDeprecated.UseNodeModelinstead.Methods in freemarker.ext.xml that return TemplateModel Modifier and Type Method Description TemplateModelNodeListModel. get(int index)Deprecated.Selects a single node from this model's nodelist by its list index and returns a new NodeListModel containing that single node.TemplateModelNodeListModel. get(String key)Deprecated.Returns a new NodeListModel containing the nodes that result from applying an operator to this model's nodes. -
Uses of TemplateModel in freemarker.template
Subinterfaces of TemplateModel in freemarker.template Modifier and Type Interface Description interfaceAdapterTemplateModelATemplateModelthat can be unwrapped and then it considers a provided desired (hint) class.interfaceTemplateBooleanModel"boolean" template language data type; same as in Java; eithertrueorfalse.interfaceTemplateCollectionModel"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.interfaceTemplateCollectionModelExExperimental - subject to change: "extended collection" template language data type: Adds size/emptiness querybility and "contains" test toTemplateCollectionModel.interfaceTemplateDateModel"date", "time" and "date-time" template language data types: corresponds toDate.interfaceTemplateDirectiveModel"directive" template language data type: used as user-defined directives (much like macros) in templates.interfaceTemplateHashModel"hash" template language data type: an object that contains other objects accessible through string keys (sub-variable names).interfaceTemplateHashModelEx"extended hash" template language data type; extendsTemplateHashModelby allowing iterating through its keys and values.interfaceTemplateMethodModelDeprecated.UseTemplateMethodModelExinstead.interfaceTemplateMethodModelEx"extended method" template language data type: Objects that act like functions.interfaceTemplateModelWithAPISupportExperimental - subject to change: ATemplateModelon which the?apioperation can be applied.interfaceTemplateNodeModel"node" template language data type: an object that is a node in a tree.interfaceTemplateNumberModel"number" template language data type; an object that stores a number.interfaceTemplateScalarModel"string" template language data-type; like in Java, an unmodifiable UNICODE character sequence.interfaceTemplateSequenceModel"sequence" template language data type; an object that contains other objects accessible through an integer 0-based index.interfaceTemplateTransformModel"transform" template language data type: user-defined directives (much like macros) specialized on filtering output; you should rather use the newerTemplateDirectiveModelinstead.Classes in freemarker.template that implement TemplateModel Modifier and Type Class Description classDefaultArrayAdapterAdapts anarrayof a non-primitive elements to the correspondingTemplateModelinterface(s), most importantly toTemplateHashModelEx.classDefaultIteratorAdapterAdapts anIteratorto the correspondingTemplateModelinterface(s), most importantly toTemplateCollectionModel.classDefaultListAdapterAdapts aListto the correspondingTemplateModelinterface(s), most importantly toTemplateSequenceModel.classDefaultMapAdapterAdapts aMapto the correspondingTemplateModelinterface(s), most importantly toTemplateHashModelEx.classDefaultNonListCollectionAdapterExperimental - subject to change: Adapts a non-ListJavaCollectionto the correspondingTemplateModelinterface(s), most importantly toTemplateCollectionModelEx.classLocalizedStringAn abstract base class for scalars that vary by locale.classResourceBundleLocalizedStringA concrete implementation ofLocalizedStringthat gets a localized string from aResourceBundleclassSimpleCollectionA simple implementation ofTemplateCollectionModel.classSimpleDateA simple implementation of the TemplateDateModel interface.classSimpleHashA simple implementation of theTemplateHashModelExinterface, using its own underlyingMaporSortedMapfor storing the hash entries.classSimpleListDeprecated.Use SimpleSequence instead.classSimpleNumberA simple implementation of the TemplateNumberModel interface.classSimpleScalarA simple implementation of the TemplateScalarModel interface, using a String.classSimpleSequenceA simple implementation of theTemplateSequenceModelinterface, using its own underlyingListfor storing the list items.classTemplateModelListSequenceA sequence that wraps aListofTemplateModel-s.Fields in freemarker.template declared as TemplateModel Modifier and Type Field Description static TemplateModelTemplateScalarModel. EMPTY_STRINGA constant value to use as the empty string.static TemplateModelTemplateModel. NOTHINGA general-purpose object to represent nothing.Methods in freemarker.template that return TemplateModel Modifier and Type Method Description TemplateModelDefaultListAdapter. get(int index)TemplateModelDefaultMapAdapter. get(String key)TemplateModelSimpleHash. get(String key)TemplateModelSimpleSequence. get(int index)Returns the item at the specified index of the list.TemplateModelTemplateHashModel. get(String key)Gets a TemplateModel from the hash.TemplateModelTemplateModelListSequence. get(int index)TemplateModelTemplateSequenceModel. get(int index)Retrieves the i-th template model in this sequence.TemplateModelDefaultListAdapter. getAPI()TemplateModelDefaultMapAdapter. getAPI()TemplateModelDefaultNonListCollectionAdapter. getAPI()TemplateModelTemplateModelWithAPISupport. getAPI()Returns the model that exposes the (Java) API of the value.TemplateModelConfiguration. getSharedVariable(String name)Gets a shared variable.TemplateModelTemplateModelAdapter. getTemplateModel()protected TemplateModelDefaultObjectWrapper. handleUnknownType(Object obj)Called for an object that aren'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.TemplateModelTemplateModelIterator. next()Returns the next model.TemplateModelDefaultObjectWrapper. wrap(Object obj)Wraps the parameter object toTemplateModelinterface(s).TemplateModelObjectWrapper. wrap(Object obj)Makes aTemplateModelout of a non-TemplateModelobject, usually by "wrapping" it into aTemplateModelimplementation that delegates to the original object.protected TemplateModelWrappingTemplateModel. wrap(Object obj)Wraps the passed object into a template model using this object's object wrapper.TemplateModelDefaultObjectWrapper. wrapDomNode(Object obj)Methods in freemarker.template with parameters of type TemplateModel Modifier and Type Method Description booleanDefaultNonListCollectionAdapter. contains(TemplateModel item)booleanTemplateCollectionModelEx. contains(TemplateModel item)Tells if a given value occurs in the collection, accodring the rules of the wrapped collection.voidTemplateDirectiveModel. execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)Executes this user-defined directive; called by FreeMarker when the user-defined directive is called in the template.voidConfiguration. setSharedVariable(String name, TemplateModel tm)Adds a shared variable to the configuration.ObjectObjectWrapperAndUnwrapper. tryUnwrapTo(TemplateModel tm, Class targetClass)Attempts to unwrap aTemplateModelto a plain Java object that's the instance of the given class (or isnull).ObjectObjectWrapperAndUnwrapper. unwrap(TemplateModel tm)Unwraps aTemplateModelto a plain Java object. -
Uses of TemplateModel in freemarker.template.utility
Classes in freemarker.template.utility that implement TemplateModel Modifier and Type Class Description classCaptureOutputDeprecated.Use block-assignments instead, like<assign x>...</assign>.classDOMNodeModelA convenient wrapper class for wrapping a Node in the W3C DOM API.classExecuteGives FreeMarker the the ability to execute external commands.classHtmlEscapePerforms an HTML escape of a given template fragment.classJythonRuntimeA crude first pass at an embeddable Jython interpreterclassNormalizeNewlinesTransformer that supports FreeMarker legacy behavior: all newlines appearing within the transformed area will be transformed into the platform's default newline.classObjectConstructorAn object that you can make available in a template to instantiate arbitrary beans-wrapped objects in a template.classStandardCompressA filter that compresses each sequence of consecutive whitespace to a single line break (if the sequence contains a line break) or a single space.classXmlEscapePerforms an XML escaping of a given template fragment.Methods in freemarker.template.utility that return TemplateModel Modifier and Type Method Description TemplateModelDOMNodeModel. get(String key)Methods in freemarker.template.utility with parameters of type TemplateModel Modifier and Type Method Description static StringClassUtil. getFTLTypeDescription(TemplateModel tm)Returns the type description of a value with FTL terms (not plain class name), as it should be used in type-related error messages and for debugging purposes.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.
-