public abstract class AbstractTemplateLoader extends Object implements TemplateLoader
Strategy interface for loading resources from class path, file system, etc.
A TemplateLoader
provides two important properties:
'.hbs'
DEFAULT_PREFIX, DEFAULT_SUFFIX
Constructor and Description |
---|
AbstractTemplateLoader() |
Modifier and Type | Method and Description |
---|---|
Charset |
getCharset() |
String |
getPrefix() |
String |
getSuffix() |
protected String |
normalize(String location)
Normalize the location by removing '/' at the beginning.
|
String |
resolve(String uri)
Resolve the uri to an absolute location.
|
void |
setCharset(Charset charset)
Set the default charset.
|
void |
setPrefix(String prefix)
Set the prefix that gets prepended to view names when building a URI.
|
void |
setSuffix(String suffix)
Set the suffix that gets appended to view names when building a URI.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
sourceAt
public String resolve(String uri)
resolve
in interface TemplateLoader
uri
- The candidate uri.protected String normalize(String location)
location
- The candidate location.public void setPrefix(String prefix)
setPrefix
in interface TemplateLoader
prefix
- The prefix that gets prepended to view names when building a
URI.public void setSuffix(String suffix)
setSuffix
in interface TemplateLoader
suffix
- The suffix that gets appended to view names when building a
URI.public void setCharset(Charset charset)
TemplateLoader
setCharset
in interface TemplateLoader
charset
- Charset.public Charset getCharset()
getCharset
in interface TemplateLoader
public String getPrefix()
getPrefix
in interface TemplateLoader
public String getSuffix()
getSuffix
in interface TemplateLoader
Copyright © 2021. All rights reserved.