play.templates

## Class TemplateLoader

- java.lang.Object
- - play.templates.TemplateLoader

    public class TemplateLoader
    extends java.lang.Object

### Field Summary

Fields
`protected static java.util.Map<java.lang.String,BaseTemplate>` `templates`

### Constructor Summary

Constructors
Constructor and Description
`TemplateLoader()`

### Method Summary

All Methods Static Methods Concrete Methods
`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 java.lang.String` `getUniqueNumberForTemplateFile(java.lang.String path)` All loaded templates is cached in the templates-list using a key.
`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

#### getUniqueNumberForTemplateFile

    public static java.lang.String getUniqueNumberForTemplateFile(java.lang.String path)

All loaded templates is cached in the templates-list using a key. This key is included as part of the classname for the generated class for a specific template. The key is included in the classname to make it possible to resolve the original template-file from the classname, when creating cleanStackTrace This method returns a unique representation of the path which is usable as part of a classname

Parameters:
  `path` - Path of the template file
Returns:
  a unique representation of the path which is usable as part of a classname

#### 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 retrieving 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 retrieving a cached template
  `source` - The template source
  `reload` - : Indicate if we must clean the cache
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