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 |
---|---|
java.lang.String |
apply(Context context)
Merge the template tree using the given context.
|
void |
apply(Context context,
java.io.Writer writer)
Merge the template tree using the given context.
|
java.lang.String |
apply(java.lang.Object context)
Merge the template tree using the given context.
|
void |
apply(java.lang.Object context,
java.io.Writer writer)
Merge the template tree using the given context.
|
<T> TypeSafeTemplate<T> |
as()
Creates a new
TypeSafeTemplate . |
<T,S extends TypeSafeTemplate<T>> |
as(java.lang.Class<S> type)
Creates a new
TypeSafeTemplate . |
java.util.List<java.lang.String> |
collect(TagType... tagType)
Collect all the tag names under the given tagType.
|
java.util.List<java.lang.String> |
collectReferenceParameters()
Collects all the parameters which are also variables.
|
java.lang.String |
filename() |
int[] |
position() |
java.lang.String |
text()
Provide the raw text.
|
java.lang.String |
toJavaScript()
Convert this template to JavaScript template (a.k.a precompiled template).
|
static final Template EMPTY
void apply(java.lang.Object context, java.io.Writer writer) throws java.io.IOException
context
- The context object. May be null.writer
- The writer object. Required.java.io.IOException
- If a resource cannot be loaded.java.lang.String apply(java.lang.Object context) throws java.io.IOException
context
- The context object. May be null.java.io.IOException
- If a resource cannot be loaded.void apply(Context context, java.io.Writer writer) throws java.io.IOException
context
- The context object. Required.writer
- The writer object. Required.java.io.IOException
- If a resource cannot be loaded.java.lang.String apply(Context context) throws java.io.IOException
context
- The context object. Required.java.io.IOException
- If a resource cannot be loaded.java.lang.String text()
java.lang.String toJavaScript()
<T,S extends TypeSafeTemplate<T>> S as(java.lang.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
.java.util.List<java.lang.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.java.util.List<java.lang.String> collectReferenceParameters()
Usage:
{{#if v1}}{{/if}} {{#each v2 "test"}}{{/each}}
collectReferenceParameters()
returns [v1, v2]
java.lang.String filename()
int[] position()
Copyright © 2010 - 2020 Adobe. All Rights Reserved