Class AbstractTemplateLoader

  • All Implemented Interfaces:
    TemplateLoader
    Direct Known Subclasses:
    URLTemplateLoader

    public abstract class AbstractTemplateLoader
    extends java.lang.Object
    implements TemplateLoader

    Strategy interface for loading resources from class path, file system, etc.

    Templates prefix and suffix

    A TemplateLoader provides two important properties:

    • prefix: useful for setting a default prefix where templates are stored.
    • suffix: useful for setting a default suffix or file extension for your templates. Default is: '.hbs'
    Since:
    1.0.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.nio.charset.Charset getCharset()  
      java.lang.String getPrefix()  
      java.lang.String getSuffix()  
      java.lang.String resolve​(java.lang.String uri)
      Resolve the uri to an absolute location.
      void setCharset​(java.nio.charset.Charset charset)
      Set the default charset.
      void setPrefix​(java.lang.String prefix)
      Set the prefix that gets prepended to view names when building a URI.
      void setSuffix​(java.lang.String suffix)
      Set the suffix that gets appended to view names when building a URI.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractTemplateLoader

        public AbstractTemplateLoader()
    • Method Detail

      • resolve

        public java.lang.String resolve​(java.lang.String uri)
        Resolve the uri to an absolute location.
        Specified by:
        resolve in interface TemplateLoader
        Parameters:
        uri - The candidate uri.
        Returns:
        Resolve the uri to an absolute location.
      • setPrefix

        public void setPrefix​(java.lang.String prefix)
        Set the prefix that gets prepended to view names when building a URI.
        Specified by:
        setPrefix in interface TemplateLoader
        Parameters:
        prefix - The prefix that gets prepended to view names when building a URI.
      • setSuffix

        public void setSuffix​(java.lang.String suffix)
        Set the suffix that gets appended to view names when building a URI.
        Specified by:
        setSuffix in interface TemplateLoader
        Parameters:
        suffix - The suffix that gets appended to view names when building a URI.
      • setCharset

        public void setCharset​(java.nio.charset.Charset charset)
        Description copied from interface: TemplateLoader
        Set the default charset.
        Specified by:
        setCharset in interface TemplateLoader
        Parameters:
        charset - Charset.
      • getCharset

        public java.nio.charset.Charset getCharset()
        Specified by:
        getCharset in interface TemplateLoader
        Returns:
        Charset.
      • getPrefix

        public java.lang.String getPrefix()
        Specified by:
        getPrefix in interface TemplateLoader
        Returns:
        The prefix that gets prepended to view names when building a URI.
      • getSuffix

        public java.lang.String getSuffix()
        Specified by:
        getSuffix in interface TemplateLoader
        Returns:
        The suffix that gets appended to view names when building a URI.