|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object freemarker.ext.misc.Methods
public final class Methods
A simple hash model that provides access to all the non-deprecated method models in this package.
The keys are as follows:
AsNumber
methodAsString
methodExecute
methodHashKeys
methodHashValues
methodIsEmpty
methodIsHash
methodIsIndexed
methodIsList
methodIsMethod
methodIsNumber
methodIsScalar
methodIsTransform
methodJoin
methodCollectionSize
methodTranslate
methodUsage:
From java:
TemplateModelRoot root = new SimpleHash(); root.put( "methods", freemarker.ext.misc.Methods.getInstance() ); ...
From your FM-Classic template:
<assign var1 = "5"> <assign var2 = "3"> <assign var3 = methods.asNumber( var1 ) + methods.asNumber( var2 )> <p>The sum of ${var1} and ${var2} is: ${var3}</p> ...
Note:
Methods
is a singleton instance. Use the
getInstance()
method to retrieve instances of this model.
Method Summary | |
---|---|
TemplateModel |
get(java.lang.String key)
Gets a TemplateModel from the hash. |
static Methods |
getInstance()
Retrieve a singleton instance of this class. |
boolean |
isEmpty()
Is the object empty? |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Methods getInstance()
Methods
classpublic boolean isEmpty() throws TemplateModelException
isEmpty
in interface TemplateModel
false
to indicate that this model is non-empty
TemplateModelException
public TemplateModel get(java.lang.String key) throws TemplateModelException
TemplateModel
from the hash.
get
in interface TemplateHashModel
key
- the name by which the TemplateModel
is identified in the template.
TemplateModel
referred to by the key,
or null
if not found.
TemplateModelException
- there was a problem getting the value
for the given key
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |