com.github.jknack.handlebars.io
Class ClassTemplateLoader

java.lang.Object
  extended by com.github.jknack.handlebars.TemplateLoader
      extended by com.github.jknack.handlebars.io.ClassTemplateLoader

public class ClassTemplateLoader
extends TemplateLoader

Load templates from the class-path. A base path can be specified at creation time. By default all the templates are loaded from '/' (a.k.a. root classpath).

Since:
0.1.0
Author:
edgar.espina

Field Summary
 
Fields inherited from class com.github.jknack.handlebars.TemplateLoader
DEFAULT_PREFIX, DEFAULT_SUFFIX
 
Constructor Summary
ClassTemplateLoader()
          Creates a new ClassTemplateLoader.
ClassTemplateLoader(String prefix)
          Creates a new ClassTemplateLoader.
ClassTemplateLoader(String prefix, String suffix)
          Creates a new ClassTemplateLoader.
 
Method Summary
protected  Reader read(String location)
          Read the resource from the given URI.
 
Methods inherited from class com.github.jknack.handlebars.TemplateLoader
getPrefix, getSuffix, load, loadAsString, resolve, setPrefix, setSuffix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassTemplateLoader

public ClassTemplateLoader(String prefix,
                           String suffix)
Creates a new ClassTemplateLoader.

Parameters:
prefix - The view prefix. Required.
suffix - The view suffix. Required.

ClassTemplateLoader

public ClassTemplateLoader(String prefix)
Creates a new ClassTemplateLoader.

Parameters:
prefix - The view prefix. Required.

ClassTemplateLoader

public ClassTemplateLoader()
Creates a new ClassTemplateLoader. It looks for templates stored in the root of the classpath.

Method Detail

read

protected Reader read(String location)
               throws IOException
Description copied from class: TemplateLoader
Read the resource from the given URI.

Specified by:
read in class TemplateLoader
Parameters:
location - The resource's location.
Returns:
The requested resource or null if not found.
Throws:
IOException - If the resource cannot be loaded.


Copyright © 2012. All Rights Reserved.