com.google.clearsilver.jsilver.compiler
Class BaseCompiledTemplate.CompiledMacro

java.lang.Object
  extended by com.google.clearsilver.jsilver.compiler.BaseCompiledTemplate.CompiledMacro
All Implemented Interfaces:
Macro, Template
Enclosing class:
BaseCompiledTemplate

public abstract class BaseCompiledTemplate.CompiledMacro
extends Object
implements Macro


Constructor Summary
protected BaseCompiledTemplate.CompiledMacro(String macroName, String... argumentsNames)
           
 
Method Summary
 RenderingContext createRenderingContext(Data data, Appendable out, ResourceLoader resourceLoader)
          Create a new RenderingContext.
 int getArgumentCount()
          Return the number of arguments this macro expects.
 String getArgumentName(int index)
          Get the name of the nth argument defined in the macro.
 String getDisplayName()
          Name to use when displaying error or log messages.
 EscapeMode getEscapeMode()
          Return the EscapeMode in which this template was generated.
 String getMacroName()
          Name of macro (e.g.
protected  TemplateLoader getTemplateLoader()
           
 String getTemplateName()
          Name of template (e.g.
 void render(Data data, Appendable out, ResourceLoader resourceLoader)
          Render the template.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.clearsilver.jsilver.template.Template
render
 

Constructor Detail

BaseCompiledTemplate.CompiledMacro

protected BaseCompiledTemplate.CompiledMacro(String macroName,
                                             String... argumentsNames)
Method Detail

render

public void render(Data data,
                   Appendable out,
                   ResourceLoader resourceLoader)
            throws IOException
Description copied from interface: Template
Render the template.

Specified by:
render in interface Template
Parameters:
data - Data to merge with template.
out - Target to write to.
resourceLoader - ResourceLoader to use instead of the default template one when loading files.
Throws:
IOException

createRenderingContext

public RenderingContext createRenderingContext(Data data,
                                               Appendable out,
                                               ResourceLoader resourceLoader)
Description copied from interface: Template
Create a new RenderingContext.

Specified by:
createRenderingContext in interface Template
Parameters:
data - Data to merge with template.
out - Target to write to.
resourceLoader - ResourceLoader to load files.

getTemplateName

public String getTemplateName()
Description copied from interface: Template
Name of template (e.g. mytemplate.cs).

Specified by:
getTemplateName in interface Template

getMacroName

public String getMacroName()
Description copied from interface: Macro
Name of macro (e.g. showTable). Used to generate error messages.

Specified by:
getMacroName in interface Macro

getArgumentName

public String getArgumentName(int index)
Description copied from interface: Macro
Get the name of the nth argument defined in the macro. Throws exception if the argument is not found.

Specified by:
getArgumentName in interface Macro

getArgumentCount

public int getArgumentCount()
Description copied from interface: Macro
Return the number of arguments this macro expects. Must be equal to the number of arguments supplied.

Specified by:
getArgumentCount in interface Macro

getTemplateLoader

protected TemplateLoader getTemplateLoader()

getEscapeMode

public EscapeMode getEscapeMode()
Description copied from interface: Template
Return the EscapeMode in which this template was generated.

Specified by:
getEscapeMode in interface Template
Returns:
EscapeMode

getDisplayName

public String getDisplayName()
Description copied from interface: Template
Name to use when displaying error or log messages. May return the same value as #getTemplateName, or may contain more information.

Specified by:
getDisplayName in interface Template


Copyright © 2010-2012 Google. All Rights Reserved.