com.google.clearsilver.jsilver.interpreter
Class InterpretedTemplateLoader

java.lang.Object
  extended by com.google.clearsilver.jsilver.interpreter.InterpretedTemplateLoader
All Implemented Interfaces:
DelegatingTemplateLoader, TemplateLoader

public class InterpretedTemplateLoader
extends Object
implements DelegatingTemplateLoader

TemplateLoader that loads InterpretedTemplates.


Constructor Summary
InterpretedTemplateLoader(TemplateFactory templateFactory, FunctionExecutor globalFunctionExecutor, AutoEscapeOptions autoEscapeOptions)
           
 
Method Summary
 Template createTemp(String name, String content, EscapeMode escapingMode)
          Create a temporary template from content, with the provided escape mode.
 Template load(String templateName, ResourceLoader resourceLoader, EscapeMode escapeMode)
          Load a template from a named resource, with the provided escape mode.
 void setTemplateLoaderDelegate(TemplateLoader templateLoaderDelegate)
          TemplateLoader that Templates will delegate back to for includes etc.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InterpretedTemplateLoader

public InterpretedTemplateLoader(TemplateFactory templateFactory,
                                 FunctionExecutor globalFunctionExecutor,
                                 AutoEscapeOptions autoEscapeOptions)
Method Detail

setTemplateLoaderDelegate

public void setTemplateLoaderDelegate(TemplateLoader templateLoaderDelegate)
Description copied from interface: DelegatingTemplateLoader
TemplateLoader that Templates will delegate back to for includes etc.

Specified by:
setTemplateLoaderDelegate in interface DelegatingTemplateLoader

load

public Template load(String templateName,
                     ResourceLoader resourceLoader,
                     EscapeMode escapeMode)
Description copied from interface: TemplateLoader
Load a template from a named resource, with the provided escape mode. If the mode is ESCAPE_HTML, ESCAPE_URL or ESCAPE_JS, the corresponding escaping will be all variables in the template. If the mode is ESCAPE_AUTO, enable auto escaping on templates. For each variable in the template, this will determine what type of escaping should be applied to the variable, and automatically apply this escaping.

Specified by:
load in interface TemplateLoader
Parameters:
templateName - e.g. some/path/to/template.cs
resourceLoader - the ResourceLoader object to use to load any files needed to satisfy this request.
escapeMode - the type of escaping to apply to the entire template.

createTemp

public Template createTemp(String name,
                           String content,
                           EscapeMode escapingMode)
Description copied from interface: TemplateLoader
Create a temporary template from content, with the provided escape mode. If the mode is ESCAPE_HTML, ESCAPE_URL or ESCAPE_JS, the corresponding escaping will be all variables in the template. If the mode is ESCAPE_AUTO, enable auto escaping on templates. For each variable in the template, this will determine what type of escaping should be applied to the variable, and automatically apply this escaping.

Specified by:
createTemp in interface TemplateLoader
Parameters:
name - A name to identify the temporary template in stack traces.
content - e.g. "Hello <cs var:name >"
escapingMode - the type of escaping to apply to the entire template.


Copyright © 2010-2012 Google. All Rights Reserved.