public class PebbleTemplateImpl extends Object implements PebbleTemplate
| Modifier and Type | Field and Description |
|---|---|
protected PebbleEngine |
engine
A template has to store a reference to the main engine so that it can
compile other templates when using the "import" or "include" tags.
|
| Constructor and Description |
|---|
PebbleTemplateImpl(PebbleEngine engine,
RootNode root,
String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
block(Writer writer,
EvaluationContext context,
String blockName,
boolean ignoreOverriden)
A typical block declaration will use this method which evaluates the
block using the regular user-provided writer.
|
void |
buildContent(Writer writer,
EvaluationContext context) |
void |
evaluate(Writer writer) |
void |
evaluate(Writer writer,
EvaluationContext context)
This is the authoritative evaluate method.
|
void |
evaluate(Writer writer,
Locale locale) |
void |
evaluate(Writer writer,
Map<String,Object> map) |
void |
evaluate(Writer writer,
Map<String,Object> map,
Locale locale) |
String |
getName() |
boolean |
hasBlock(String blockName) |
boolean |
hasMacro(String macroName) |
void |
importTemplate(EvaluationContext context,
String name)
Imports a template.
|
void |
includeTemplate(Writer writer,
EvaluationContext context,
String name) |
String |
macro(EvaluationContext context,
String macroName,
ArgumentsNode args,
boolean ignoreOverriden) |
void |
registerBlock(Block block)
Registers a block.
|
void |
registerMacro(Macro macro) |
void |
setParent(EvaluationContext context,
String parentName) |
protected final PebbleEngine engine
public PebbleTemplateImpl(PebbleEngine engine, RootNode root, String name) throws PebbleException
PebbleExceptionpublic void buildContent(Writer writer, EvaluationContext context) throws IOException, PebbleException
IOExceptionPebbleExceptionpublic void evaluate(Writer writer) throws PebbleException, IOException
evaluate in interface PebbleTemplatePebbleExceptionIOExceptionpublic void evaluate(Writer writer, Locale locale) throws PebbleException, IOException
evaluate in interface PebbleTemplatePebbleExceptionIOExceptionpublic void evaluate(Writer writer, Map<String,Object> map) throws PebbleException, IOException
evaluate in interface PebbleTemplatePebbleExceptionIOExceptionpublic void evaluate(Writer writer, Map<String,Object> map, Locale locale) throws PebbleException, IOException
evaluate in interface PebbleTemplatePebbleExceptionIOExceptionpublic void evaluate(Writer writer, EvaluationContext context) throws PebbleException, IOException
writer - The writer used to write the final output of the templatecontext - The evaluation contextPebbleException - Thrown if any sort of template error occursIOException - Thrown from the writer objectpublic void importTemplate(EvaluationContext context, String name) throws PebbleException
context - The evaluation contextname - The template namePebbleException - Thrown if an error occurs while rendering the imported templatepublic void includeTemplate(Writer writer, EvaluationContext context, String name) throws PebbleException, IOException
PebbleExceptionIOExceptionpublic boolean hasMacro(String macroName)
public void registerBlock(Block block)
block - The blockpublic boolean hasBlock(String blockName)
public void registerMacro(Macro macro) throws PebbleException
PebbleExceptionpublic void block(Writer writer, EvaluationContext context, String blockName, boolean ignoreOverriden) throws PebbleException, IOException
blockName - The name of the blockcontext - The evaluation contextignoreOverriden - Whether or not to ignore overriden blockswriter - The writerPebbleException - Thrown if an error occursIOException - Thrown from the writer objectpublic String macro(EvaluationContext context, String macroName, ArgumentsNode args, boolean ignoreOverriden) throws PebbleException
PebbleExceptionpublic void setParent(EvaluationContext context, String parentName) throws PebbleException
PebbleExceptionpublic String getName()
Copyright © 2015. All rights reserved.