Interface TemplateCollectionModelEx

  • All Superinterfaces:
    TemplateCollectionModel, TemplateModel
    All Known Implementing Classes:
    DefaultNonListCollectionAdapter

    public interface TemplateCollectionModelEx
    extends TemplateCollectionModel
    Experimental - subject to change: "extended collection" template language data type: Adds size/emptiness querybility and "contains" test to TemplateCollectionModel. The added extra operations is provided by all Java Collection-s, and this interface was added to make that accessible for templates too.

    Experimental status warning: This interface is subject to change on non-backward compatible ways, hence, it shouldn't be implemented outside FreeMarker yet.

    Since:
    2.3.22
    • Method Detail

      • isEmpty

        boolean isEmpty()
                 throws TemplateModelException
        Returns if the collection contains any elements. This differs from size() != 0 only in that the exact number of items need not be calculated.
        Throws:
        TemplateModelException
      • contains

        boolean contains​(TemplateModel item)
                  throws TemplateModelException
        Tells if a given value occurs in the collection, accodring the rules of the wrapped collection. As of 2.3.22, this interface is not yet utilized by FTL, and certainly it won't be earlier than 2.4.0. The usefulness of this method is questionable, as the equality rules of Java differs from that of FTL, hence, calling this won't be equivalent with ?seq_contains(e).
        Throws:
        TemplateModelException