Class Qute.Fmt

  • Enclosing class:
    Qute

    public static final class Qute.Fmt
    extends Object
    This construct is not thread-safe.
    • Method Detail

      • cache

        public Qute.Fmt cache()
        Use the template cache, i.e. first attempt to find the parsed template in the cahce and if not found then parse the template and store the instance in the cache.

        Note that caching greatly improves the performance of formatting, albeit increases the memory usage.

        Returns:
        self
        See Also:
        Qute.clearCache()
      • noCache

        public Qute.Fmt noCache()
        Do not use the cache, i.e. always parse the template.
        Returns:
        self
      • contentType

        public Qute.Fmt contentType​(String contentType)
        Set the template content type.
        Returns:
        self
        See Also:
        Variant
      • variant

        public Qute.Fmt variant​(Variant variant)
        Set the template variant.
        Returns:
        self
        See Also:
        Variant
      • dataArray

        public Qute.Fmt dataArray​(Object... data)
        The data array is accessibe via the data key, e.g. {data[0]} is resolved to the first argument.

        An empty expression {} is a placeholder that is replaced with an index-based array accessor {data[n]} where n is the index of the placeholder. The first placeholder is replace with {data[0]}, the second with {data[1]}, and so on. For example, "Hello {}!" becomes Hello {data[0]}!.

        Parameters:
        data -
        Returns:
        self
      • render

        public String render()
        Returns:
        the rendered template
      • instance

        public TemplateInstance instance()
        Returns:
        a new template instance