Class RecordTemplateModel

java.lang.Object
com.northconcepts.datapipeline.template.RecordTemplateModel
All Implemented Interfaces:
freemarker.template.AdapterTemplateModel, freemarker.template.TemplateHashModel, freemarker.template.TemplateHashModelEx, freemarker.template.TemplateHashModelEx2, freemarker.template.TemplateModel, Serializable

public class RecordTemplateModel extends Object implements freemarker.template.TemplateHashModelEx2, freemarker.template.AdapterTemplateModel, Serializable
Exposes a Record to FreeMarker templates as a hash keyed by field name, with values wrapped by the object wrapper.
See Also:
  • Constructor Details

    • RecordTemplateModel

      public RecordTemplateModel()
    • RecordTemplateModel

      public RecordTemplateModel(Record record, freemarker.template.ObjectWrapper objectWrapper)
  • Method Details

    • getRecord

      public Record getRecord()
    • setRecord

      public RecordTemplateModel setRecord(Record record)
    • getObjectWrapper

      public freemarker.template.ObjectWrapper getObjectWrapper()
    • setObjectWrapper

      public RecordTemplateModel setObjectWrapper(freemarker.template.ObjectWrapper objectWrapper)
    • 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() throws freemarker.template.TemplateModelException
      Specified by:
      isEmpty in interface freemarker.template.TemplateHashModel
      Throws:
      freemarker.template.TemplateModelException
    • keyValuePairIterator

      public freemarker.template.TemplateHashModelEx2.KeyValuePairIterator keyValuePairIterator() throws freemarker.template.TemplateModelException
      Specified by:
      keyValuePairIterator in interface freemarker.template.TemplateHashModelEx2
      Throws:
      freemarker.template.TemplateModelException
    • getAdaptedObject

      public Object getAdaptedObject(Class<?> hint)
      Specified by:
      getAdaptedObject in interface freemarker.template.AdapterTemplateModel
    • wrap

      public static List<RecordTemplateModel> wrap(RecordList recordList, freemarker.template.ObjectWrapper objectWrapper)
      Returns a new list with each record of the list wrapped in a model that uses the given object wrapper.
    • wrap

      public static List<RecordTemplateModel> wrap(Collection<Record> records, freemarker.template.ObjectWrapper objectWrapper)
      Returns a new list with each record of the collection wrapped in a model that uses the given object wrapper.