Package com.github.jknack.handlebars.io
Class AbstractTemplateLoader
- java.lang.Object
-
- com.github.jknack.handlebars.io.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
-
-
Field Summary
-
Fields inherited from interface com.github.jknack.handlebars.io.TemplateLoader
DEFAULT_PREFIX, DEFAULT_SUFFIX
-
-
Constructor Summary
Constructors Constructor Description AbstractTemplateLoader()
-
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
-
Methods inherited from interface com.github.jknack.handlebars.io.TemplateLoader
sourceAt
-
-
-
-
Method Detail
-
resolve
public java.lang.String resolve(java.lang.String uri)
Resolve the uri to an absolute location.- Specified by:
resolve
in interfaceTemplateLoader
- 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 interfaceTemplateLoader
- 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 interfaceTemplateLoader
- 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 interfaceTemplateLoader
- Parameters:
charset
- Charset.
-
getCharset
public java.nio.charset.Charset getCharset()
- Specified by:
getCharset
in interfaceTemplateLoader
- Returns:
- Charset.
-
getPrefix
public java.lang.String getPrefix()
- Specified by:
getPrefix
in interfaceTemplateLoader
- Returns:
- The prefix that gets prepended to view names when building a URI.
-
getSuffix
public java.lang.String getSuffix()
- Specified by:
getSuffix
in interfaceTemplateLoader
- Returns:
- The suffix that gets appended to view names when building a URI.
-
-