public interface Template
Handlebars.compileInline(String)
.Modifier and Type | Field and Description |
---|---|
static Template |
EMPTY
An empty template implementation.
|
Modifier and Type | Method and Description |
---|---|
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> type)
Creates a new
TypeSafeTemplate . |
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.
|
String |
filename() |
int[] |
position() |
String |
text()
Provide the raw text.
|
String |
toJavaScript()
Convert this template to JavaScript template (a.k.a precompiled template).
|
static final Template EMPTY
void apply(Object context, Writer writer) throws IOException
context
- The context object. May be null.writer
- The writer object. Required.IOException
- If a resource cannot be loaded.String apply(Object context) throws IOException
context
- The context object. May be null.IOException
- If a resource cannot be loaded.void apply(Context context, Writer writer) throws IOException
context
- The context object. Required.writer
- The writer object. Required.IOException
- If a resource cannot be loaded.String apply(Context context) throws IOException
context
- The context object. Required.IOException
- If a resource cannot be loaded.String text()
String toJavaScript()
<T,S extends TypeSafeTemplate<T>> S as(Class<S> type)
TypeSafeTemplate
.T
- The root type.S
- The template type.type
- The template type. Required.TypeSafeTemplate
.<T> TypeSafeTemplate<T> as()
TypeSafeTemplate
.T
- The root type.TypeSafeTemplate
.List<String> collect(TagType... tagType)
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]
tagType
- The tag type. Required.List<String> collectReferenceParameters()
Usage:
{{#if v1}}{{/if}} {{#each v2 "test"}}{{/each}}
collectReferenceParameters()
returns [v1, v2]
String filename()
int[] position()
Copyright © 2010 - 2020 Adobe. All Rights Reserved