Interface TemplateSequenceModel

All Superinterfaces:
TemplateModel
All Known Implementing Classes:
ArrayModel, CollectionModel, DefaultArrayAdapter, DefaultListAdapter, JythonSequenceModel, NodeListModel, NodeListModel, NodeModel, OverloadedMethodsModel, RhinoFunctionModel, RhinoScriptableModel, SimpleList, SimpleMethodModel, SimpleSequence, TemplateModelListSequence

public interface TemplateSequenceModel extends TemplateModel
"sequence" template language data type; an object that contains other objects accessible through an integer 0-based index.

Used in templates like: mySeq[index], <#list mySeq as i>...</#list>, mySeq?size, etc.

See Also:
TemplateCollectionModel
  • Field Summary

    Fields inherited from interface freemarker.template.TemplateModel

    NOTHING
  • Method Summary

    Modifier and Type
    Method
    Description
    get​(int index)
    Retrieves the i-th template model in this sequence.
    int
     
  • Method Details

    • get

      TemplateModel get(int index) throws TemplateModelException
      Retrieves the i-th template model in this sequence.
      Returns:
      the item at the specified index, or null if the index is out of bounds. Note that a null value is interpreted by FreeMarker as "variable does not exist", and accessing a missing variables is usually considered as an error in the FreeMarker Template Language, so the usage of a bad index will not remain hidden, unless the default value for that case was also specified in the template.
      Throws:
      TemplateModelException
    • size

      int size() throws TemplateModelException
      Returns:
      the number of items in the list.
      Throws:
      TemplateModelException