Package fmpp.util
Class FreemarkerUtil
java.lang.Object
fmpp.util.FreemarkerUtil
FreeMarker related utilities.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Object
ftlVarToCoreJavaObject
(freemarker.template.TemplateModel m) ConvertsTemplateModel
-s tojava.util.*
andjava.lang.*
objects.
-
Constructor Details
-
FreemarkerUtil
public FreemarkerUtil()
-
-
Method Details
-
ftlVarToCoreJavaObject
public static Object ftlVarToCoreJavaObject(freemarker.template.TemplateModel m) throws freemarker.template.TemplateModelException ConvertsTemplateModel
-s tojava.util.*
andjava.lang.*
objects.- FTL hash will be converted to
java.util.Map
- FTL sequence and collection will be converted to
java.util.List
- FTL numbers will be converted to
java.lang.Number
- FTL dates will be converted to
java.util.Date
- FTL booleans will be converted to
java.lang.Boolean
- FTL strings will be converted to
java.lang.String
- Other FTL variables (transforms, methods, etc.) will be returned as is.
Container types (hash, equence, etc.) will be converted recursively, so the subvariables are also converted, and the subvariables of subvariables are converted, etc.
For multi-type variables a single type will be choosen, which is the first type in the above list.
If the
TemplateModel
supportsWrapperTemplateModel
, unwrapping will be used only if the type of the unwrapped object is proper according to the above list.- Returns:
- The converted object. You may do not modify the returned
objects, as it is unpredicalbe if it has effect on the converted
TemplateModel
-s. - Throws:
freemarker.template.TemplateModelException
- FTL hash will be converted to
-