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
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 -
Method Summary
Modifier and TypeMethodDescriptionResolve the uri to an absolute location.voidsetCharset(Charset charset) Set the default charset.voidSet the prefix that gets prepended to view names when building a URI.voidSet 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, waitMethods inherited from interface com.github.jknack.handlebars.io.TemplateLoader
sourceAt
-
Constructor Details
-
AbstractTemplateLoader
public AbstractTemplateLoader()
-
-
Method Details
-
resolve
Resolve the uri to an absolute location.- Specified by:
resolvein interfaceTemplateLoader- Parameters:
uri- The candidate uri.- Returns:
- Resolve the uri to an absolute location.
-
setPrefix
Set the prefix that gets prepended to view names when building a URI.- Specified by:
setPrefixin interfaceTemplateLoader- Parameters:
prefix- The prefix that gets prepended to view names when building a URI.
-
setSuffix
Set the suffix that gets appended to view names when building a URI.- Specified by:
setSuffixin interfaceTemplateLoader- Parameters:
suffix- The suffix that gets appended to view names when building a URI.
-
setCharset
Description copied from interface:TemplateLoaderSet the default charset.- Specified by:
setCharsetin interfaceTemplateLoader- Parameters:
charset- Charset.
-
getCharset
- Specified by:
getCharsetin interfaceTemplateLoader- Returns:
- Charset.
-
getPrefix
- Specified by:
getPrefixin interfaceTemplateLoader- Returns:
- The prefix that gets prepended to view names when building a URI.
-
getSuffix
- Specified by:
getSuffixin interfaceTemplateLoader- Returns:
- The suffix that gets appended to view names when building a URI.
-