Class ModelIncludeDirective

  • All Implemented Interfaces:
    freemarker.template.TemplateDirectiveModel, freemarker.template.TemplateModel

    public class ModelIncludeDirective
    extends java.lang.Object
    implements freemarker.template.TemplateDirectiveModel
    A TemplateDirectiveModel which allows to recursively write a graph of Writables, with each element using its own template. Elements are imported into the parent template by using this directive like so: <@includeModel object=myProperty/>.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private freemarker.template.Configuration configuration  
      • Fields inherited from interface freemarker.template.TemplateModel

        NOTHING
    • Constructor Summary

      Constructors 
      Constructor Description
      ModelIncludeDirective​(freemarker.template.Configuration configuration)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private ModelWriter.DefaultModelElementWriterContext createContext​(java.util.Map params)
      Creates a writer context providing access to the FreeMarker Configuration and a map with any additional parameters passed to the directive.
      void execute​(freemarker.core.Environment env, java.util.Map params, freemarker.template.TemplateModel[] loopVars, freemarker.template.TemplateDirectiveBody body)  
      private Writable getModelElement​(java.util.Map params)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • configuration

        private final freemarker.template.Configuration configuration
    • Constructor Detail

      • ModelIncludeDirective

        public ModelIncludeDirective​(freemarker.template.Configuration configuration)
    • Method Detail

      • execute

        public void execute​(freemarker.core.Environment env,
                            java.util.Map params,
                            freemarker.template.TemplateModel[] loopVars,
                            freemarker.template.TemplateDirectiveBody body)
                     throws freemarker.template.TemplateException,
                            java.io.IOException
        Specified by:
        execute in interface freemarker.template.TemplateDirectiveModel
        Throws:
        freemarker.template.TemplateException
        java.io.IOException
      • getModelElement

        private Writable getModelElement​(java.util.Map params)
      • createContext

        private ModelWriter.DefaultModelElementWriterContext createContext​(java.util.Map params)
        Creates a writer context providing access to the FreeMarker Configuration and a map with any additional parameters passed to the directive.
        Parameters:
        params - The parameter map passed to this directive.
        Returns:
        A writer context.