Class SiteContextHashModel

java.lang.Object
org.craftercms.engine.util.freemarker.SiteContextHashModel
All Implemented Interfaces:
freemarker.template.TemplateHashModel, freemarker.template.TemplateHashModelEx, freemarker.template.TemplateModel

public class SiteContextHashModel extends Object implements freemarker.template.TemplateHashModelEx
Implementation of TemplateHashModelEx to safely expose the SiteContext instance in templates
Since:
3.1.7
Author:
joseross
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected freemarker.template.ObjectWrapper
     
    static final String
     

    Fields inherited from interface freemarker.template.TemplateModel

    NOTHING
  • Constructor Summary

    Constructors
    Constructor
    Description
    SiteContextHashModel(freemarker.template.ObjectWrapper objectWrapper)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    freemarker.template.TemplateModel
    get(String key)
     
    boolean
     
    freemarker.template.TemplateCollectionModel
     
    int
     
    freemarker.template.TemplateCollectionModel
     

    Methods inherited from class java.lang.Object

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

    • SITE_NAME_KEY

      public static final String SITE_NAME_KEY
      See Also:
    • objectWrapper

      protected freemarker.template.ObjectWrapper objectWrapper
  • Constructor Details

    • SiteContextHashModel

      public SiteContextHashModel(freemarker.template.ObjectWrapper objectWrapper)
  • Method Details

    • size

      public int size() throws freemarker.template.TemplateModelException
      Specified by:
      size in interface freemarker.template.TemplateHashModelEx
      Throws:
      freemarker.template.TemplateModelException
    • keys

      public freemarker.template.TemplateCollectionModel keys() throws freemarker.template.TemplateModelException
      Specified by:
      keys in interface freemarker.template.TemplateHashModelEx
      Throws:
      freemarker.template.TemplateModelException
    • values

      public freemarker.template.TemplateCollectionModel values() throws freemarker.template.TemplateModelException
      Specified by:
      values in interface freemarker.template.TemplateHashModelEx
      Throws:
      freemarker.template.TemplateModelException
    • get

      public freemarker.template.TemplateModel get(String key) throws freemarker.template.TemplateModelException
      Specified by:
      get in interface freemarker.template.TemplateHashModel
      Throws:
      freemarker.template.TemplateModelException
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface freemarker.template.TemplateHashModel