fmpp.util
Class FreemarkerUtil

java.lang.Object
  extended by fmpp.util.FreemarkerUtil

public class FreemarkerUtil
extends java.lang.Object

FreeMarker related utilities.


Constructor Summary
FreemarkerUtil()
           
 
Method Summary
static java.lang.Object ftlVarToCoreJavaObject(freemarker.template.TemplateModel m)
          Converts TemplateModel-s to java.util.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FreemarkerUtil

public FreemarkerUtil()
Method Detail

ftlVarToCoreJavaObject

public static java.lang.Object ftlVarToCoreJavaObject(freemarker.template.TemplateModel m)
                                               throws freemarker.template.TemplateModelException
Converts TemplateModel-s to java.util.* and java.lang.* objects.

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 supports WrapperTemplateModel, 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