play.templates
Class TemplateLoader

java.lang.Object
  extended by play.templates.TemplateLoader

public class TemplateLoader
extends java.lang.Object

Load templates


Field Summary
protected static java.util.Map<java.lang.String,BaseTemplate> templates
           
 
Constructor Summary
TemplateLoader()
           
 
Method Summary
static void cleanCompiledCache()
          Cleans the cache for all templates
static void cleanCompiledCache(java.lang.String key)
          Cleans the specified key from the cache
static java.util.List<Template> getAllTemplate()
          List all found templates
static Template load(java.lang.String path)
          Load a template
static BaseTemplate load(java.lang.String key, java.lang.String source)
          Load a template from a String
static BaseTemplate load(java.lang.String key, java.lang.String source, boolean reload)
          Clean the cache for that key Then load a template from a String
static Template load(VirtualFile file)
          Load a template from a virtual file
static BaseTemplate loadString(java.lang.String source)
          Load template from a String, but don't cache it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

templates

protected static java.util.Map<java.lang.String,BaseTemplate> templates
Constructor Detail

TemplateLoader

public TemplateLoader()
Method Detail

load

public static Template load(VirtualFile file)
Load a template from a virtual file

Parameters:
file - A VirtualFile
Returns:
The executable template

load

public static BaseTemplate load(java.lang.String key,
                                java.lang.String source)
Load a template from a String

Parameters:
key - A unique identifier for the template, used for retreiving a cached template
source - The template source
Returns:
A Template

load

public static BaseTemplate load(java.lang.String key,
                                java.lang.String source,
                                boolean reload)
Clean the cache for that key Then load a template from a String

Parameters:
key - A unique identifier for the template, used for retreiving a cached template
source - The template source
Returns:
A Template

loadString

public static BaseTemplate loadString(java.lang.String source)
Load template from a String, but don't cache it

Parameters:
source - The template source
Returns:
A Template

cleanCompiledCache

public static void cleanCompiledCache()
Cleans the cache for all templates


cleanCompiledCache

public static void cleanCompiledCache(java.lang.String key)
Cleans the specified key from the cache

Parameters:
key - The template key

load

public static Template load(java.lang.String path)
Load a template

Parameters:
path - The path of the template (ex: Application/index.html)
Returns:
The executable template

getAllTemplate

public static java.util.List<Template> getAllTemplate()
List all found templates

Returns:
A list of executable templates


Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly