public class Template
extends java.lang.Object
parse(...) to get a hold of a reference.
Also see: https://github.com/Shopify/liquid| Modifier and Type | Class and Description |
|---|---|
static class |
Template.ContextHolder
Sometimes the custom tags needs to return some extra-data, that is not rendarable.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<java.lang.RuntimeException> |
errors() |
org.antlr.v4.runtime.tree.ParseTree |
getParseTree()
Returns the root of the parse tree of the parsed input.
|
static Template |
parse(java.io.File file)
Returns a new Template instance from a given input file.
|
static Template |
parse(java.io.File file,
Flavor flavor)
Deprecated.
|
static Template |
parse(java.io.File file,
ParseSettings settings) |
static Template |
parse(java.io.File file,
ParseSettings parseSettings,
RenderSettings renderSettings) |
static Template |
parse(java.io.InputStream input) |
static Template |
parse(java.io.InputStream input,
ParseSettings settings) |
static Template |
parse(java.lang.String input)
Returns a new Template instance from a given input string.
|
static Template |
parse(java.lang.String input,
Flavor flavor)
Deprecated.
|
static Template |
parse(java.lang.String input,
ParseSettings settings) |
static Template |
parse(java.lang.String template,
ParseSettings parseSettings,
RenderSettings renderSettings) |
java.lang.String |
render() |
java.lang.String |
render(boolean convertValueToMap,
java.lang.String key,
java.lang.Object value,
java.lang.Object... keyValues) |
java.lang.String |
render(Inspectable object) |
java.lang.String |
render(java.util.Map<java.lang.String,java.lang.Object> variables)
Renders the template.
|
java.lang.String |
render(java.util.Map<java.lang.String,java.lang.Object> variables,
java.util.concurrent.ExecutorService executorService,
boolean shutdown) |
java.lang.String |
render(java.lang.String jsonMap)
Renders the template.
|
java.lang.String |
render(java.lang.String key,
java.lang.Object value,
java.lang.Object... keyValues)
Renders the template.
|
java.lang.String |
renderObject(java.lang.Object obj)
Render the template with given object, treating it same way as
Inspectable instance. |
java.lang.String |
renderUnguarded(java.util.Map<java.lang.String,java.lang.Object> variables)
Renders the template without guards provided by protection settings.
|
java.lang.String |
renderUnguarded(java.util.Map<java.lang.String,java.lang.Object> variables,
TemplateContext parent,
boolean doClearThreadLocal) |
java.lang.String |
renderUnguarded(TemplateContext parent)
Renders the template using parent context
|
java.lang.String |
toStringAST()
Deprecated.
|
java.lang.String |
toStringTree()
Returns a string representation of the parse tree of the parsed
input source.
|
Template |
with(Filter filter) |
Template |
with(Tag tag) |
Template |
withContextHolder(Template.ContextHolder holder) |
Template |
withProtectionSettings(ProtectionSettings protectionSettings) |
Template |
withRenderSettings(RenderSettings renderSettings) |
public org.antlr.v4.runtime.tree.ParseTree getParseTree()
public static Template parse(java.lang.String input)
input - the input string holding the Liquid source.public static Template parse(java.io.File file) throws java.io.IOException
file - the input file holding the Liquid source.java.io.IOExceptionpublic static Template parse(java.io.File file, ParseSettings settings) throws java.io.IOException
java.io.IOExceptionpublic static Template parse(java.lang.String input, ParseSettings settings)
public static Template parse(java.io.File file, ParseSettings parseSettings, RenderSettings renderSettings) throws java.io.IOException
java.io.IOExceptionpublic static Template parse(java.lang.String template, ParseSettings parseSettings, RenderSettings renderSettings)
public static Template parse(java.io.InputStream input)
public static Template parse(java.io.InputStream input, ParseSettings settings)
@Deprecated public static Template parse(java.io.File file, Flavor flavor) throws java.io.IOException
java.io.IOException@Deprecated public static Template parse(java.lang.String input, Flavor flavor) throws java.io.IOException
java.io.IOExceptionpublic Template withProtectionSettings(ProtectionSettings protectionSettings)
public Template withRenderSettings(RenderSettings renderSettings)
public Template withContextHolder(Template.ContextHolder holder)
public java.util.List<java.lang.RuntimeException> errors()
public java.lang.String render(java.lang.String jsonMap)
jsonMap - a JSON-map denoting the (possibly nested)
variables that can be used in this Template.public java.lang.String render()
public java.lang.String render(Inspectable object)
public java.lang.String renderObject(java.lang.Object obj)
Inspectable instance.public java.lang.String render(java.lang.String key,
java.lang.Object value,
java.lang.Object... keyValues)
key - a keyvalue - the value belonging to the keykeyValues - an array denoting key-value pairs where the
uneven numbers (even indexes) should be Strings.
If the length of this array is uneven, the last
key (without the value) gets `null` attached to
it. Note that a call to this method with a single
String as parameter, will be handled by
`render(String jsonMap)` instead.public java.lang.String render(boolean convertValueToMap,
java.lang.String key,
java.lang.Object value,
java.lang.Object... keyValues)
public java.lang.String render(java.util.Map<java.lang.String,java.lang.Object> variables)
variables - a Map denoting the (possibly nested)
variables that can be used in this
Template.public java.lang.String render(java.util.Map<java.lang.String,java.lang.Object> variables,
java.util.concurrent.ExecutorService executorService,
boolean shutdown)
public java.lang.String renderUnguarded(java.util.Map<java.lang.String,java.lang.Object> variables)
variables - a Map denoting the (possibly nested)
variables that can be used in this
Template.public java.lang.String renderUnguarded(java.util.Map<java.lang.String,java.lang.Object> variables,
TemplateContext parent,
boolean doClearThreadLocal)
public java.lang.String renderUnguarded(TemplateContext parent)
parent - @Deprecated public java.lang.String toStringAST()
public java.lang.String toStringTree()
Copyright © 2012–2021. All rights reserved.