Modifier and Type | Field and Description |
---|---|
protected int |
column
The column of this template.
|
protected String |
filename
The file's name.
|
protected Handlebars |
handlebars
The handlebars object.
|
protected int |
line
The line of this template.
|
Constructor and Description |
---|
PartialBlockForwardingTemplate(Template parent,
Template block,
Template parentPartialBlock,
Template callee,
Handlebars handlebars)
Constructs a PartialBlockForwardingTemplate.
|
Modifier and Type | Method and Description |
---|---|
void |
after(Context context,
Writer writer)
Notify that template has been processed.
|
String |
apply(Context context)
Merge the template tree using the given context.
|
void |
apply(Context context,
Writer writer)
Merge the template tree using the given context.
|
String |
apply(Object context)
Merge the template tree using the given context.
|
void |
apply(Object context,
Writer writer)
Merge the template tree using the given context.
|
<T> TypeSafeTemplate<T> |
as()
Creates a new
TypeSafeTemplate . |
<T,S extends TypeSafeTemplate<T>> |
as(Class<S> rootType)
Creates a new
TypeSafeTemplate . |
void |
before(Context context,
Writer writer)
Notify that template is going to be processed.
|
protected void |
collect(Collection<String> result,
TagType tagType)
Child classes might want to check if they apply to the tagtype and append them self to the
result list.
|
List<String> |
collect(TagType... tagType)
Collect all the tag names under the given tagType.
|
List<String> |
collectReferenceParameters()
Collects all the parameters which are also variables.
|
protected void |
collectReferenceParameters(Collection<String> result) |
boolean |
decorate() |
String |
filename() |
com.github.jknack.handlebars.internal.BaseTemplate |
filename(String filename)
Set the file's name.
|
protected void |
merge(Context context,
Writer writer)
Merge a child template into the writer.
|
int[] |
position() |
com.github.jknack.handlebars.internal.BaseTemplate |
position(int line,
int column)
Set the template position.
|
String |
text()
Provide the raw text.
|
String |
toJavaScript()
Convert this template to JavaScript template (a.k.a precompiled template).
|
String |
toString() |
protected final Handlebars handlebars
protected int line
protected int column
protected String filename
public PartialBlockForwardingTemplate(Template parent, Template block, Template parentPartialBlock, Template callee, Handlebars handlebars)
parent
- the parent partialblock
- the block to be passed as partial-block.parentPartialBlock
- the previous partial-block definition of
the template which contains this partial.callee
- the template that renders the parenthandlebars
- handlebarsprotected void merge(Context context, Writer writer) throws IOException
context
- The scope object.writer
- The writer.IOException
- If a resource cannot be loaded.public String text()
public final String apply(Object context) throws IOException
apply
in interface Template
context
- The context object. May be null.IOException
- If a resource cannot be loaded.public final void apply(Object context, Writer writer) throws IOException
apply
in interface Template
context
- The context object. May be null.writer
- The writer object. Required.IOException
- If a resource cannot be loaded.public String apply(Context context) throws IOException
Template
apply
in interface Template
context
- The context object. Required.IOException
- If a resource cannot be loaded.public void apply(Context context, Writer writer) throws IOException
Template
apply
in interface Template
context
- The context object. Required.writer
- The writer object. Required.IOException
- If a resource cannot be loaded.public void before(Context context, Writer writer) throws IOException
context
- The context object. Required.writer
- The writer object. Required.IOException
- If a resource cannot be loaded.public void after(Context context, Writer writer) throws IOException
context
- The context object. Required.writer
- The writer object. Required.IOException
- If a resource cannot be loaded.public com.github.jknack.handlebars.internal.BaseTemplate filename(String filename)
filename
- The file's name.public String filename()
public int[] position()
public com.github.jknack.handlebars.internal.BaseTemplate position(int line, int column)
line
- The line.column
- The column.public <T,S extends TypeSafeTemplate<T>> S as(Class<S> rootType)
Template
TypeSafeTemplate
.as
in interface Template
T
- The root type.S
- The template type.rootType
- The template type. Required.TypeSafeTemplate
.public <T> TypeSafeTemplate<T> as()
Template
TypeSafeTemplate
.as
in interface Template
T
- The root type.TypeSafeTemplate
.public List<String> collect(TagType... tagType)
Template
Usage:
{{hello}} {{var 1}} {{{tripleVar}}}
collect(TagType.VAR)
returns [hello, var]
collect(TagType.TRIPLE_VAR)
returns [tripleVar]
collect(TagType.VAR, TagType.TRIPLE_VAR)
returns
[hello, var, tripleVar]
protected void collect(Collection<String> result, TagType tagType)
result
- The result list.tagType
- The matching tagtype.public List<String> collectReferenceParameters()
Template
Usage:
{{#if v1}}{{/if}} {{#each v2 "test"}}{{/each}}
collectReferenceParameters()
returns [v1, v2]
collectReferenceParameters
in interface Template
protected void collectReferenceParameters(Collection<String> result)
result
- The result list to add new parameters to.public String toJavaScript()
Template
toJavaScript
in interface Template
public boolean decorate()
Copyright © 2021. All rights reserved.