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 insertions needs to return some extra-data, that is not rendarable.
|
| Modifier and Type | Field and Description |
|---|---|
protected ParseSettings |
parseSettings
Deprecated.
|
protected ProtectionSettings |
protectionSettings
Deprecated.
|
protected RenderSettings |
renderSettings
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<java.lang.RuntimeException> |
errors() |
ParseSettings |
getParseSettings() |
org.antlr.v4.runtime.tree.ParseTree |
getParseTree()
Returns the root of the parse tree of the parsed input.
|
ProtectionSettings |
getProtectionSettings() |
RenderSettings |
getRenderSettings() |
static Template |
parse(java.io.File file)
Deprecated.
|
static Template |
parse(java.io.File file,
Flavor flavor)
Deprecated.
|
static Template |
parse(java.io.File file,
ParseSettings settings)
Deprecated.
|
static Template |
parse(java.io.File file,
ParseSettings parseSettings,
RenderSettings renderSettings)
Deprecated.
|
static Template |
parse(java.io.InputStream input)
Deprecated.
|
static Template |
parse(java.io.InputStream input,
ParseSettings settings)
Deprecated.
|
static Template |
parse(java.lang.String input)
Deprecated.
|
static Template |
parse(java.lang.String input,
Flavor flavor)
Deprecated.
|
static Template |
parse(java.lang.String input,
java.util.List<Insertion> insertions,
java.util.List<Filter> filters)
Deprecated.
|
static Template |
parse(java.lang.String input,
java.util.List<Insertion> insertions,
java.util.List<Filter> filters,
ParseSettings parseSettings,
RenderSettings renderSettings)
Deprecated.
|
static Template |
parse(java.lang.String input,
ParseSettings settings)
Deprecated.
|
static Template |
parse(java.lang.String input,
ParseSettings parseSettings,
RenderSettings renderSettings)
Deprecated.
|
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.Object |
renderToObject() |
java.lang.Object |
renderToObject(Inspectable object) |
java.lang.Object |
renderToObject(java.util.Map<java.lang.String,java.lang.Object> variables)
Renders the template.
|
java.lang.Object |
renderToObject(java.lang.String jsonMap) |
java.lang.Object |
renderToObjectUnguarded(java.util.Map<java.lang.String,java.lang.Object> variables)
Renders the template without guards provided by protection settings.
|
java.lang.Object |
renderToObjectUnguarded(java.util.Map<java.lang.String,java.lang.Object> variables,
TemplateContext parent,
boolean doClearThreadLocal) |
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 |
withContextHolder(Template.ContextHolder holder) |
Template |
withProtectionSettings(ProtectionSettings settings)
Deprecated.
use
TemplateParser |
Template |
withRenderSettings(RenderSettings settings)
Deprecated.
use
TemplateParser |
@Deprecated protected ProtectionSettings protectionSettings
@Deprecated protected RenderSettings renderSettings
@Deprecated protected final ParseSettings parseSettings
public org.antlr.v4.runtime.tree.ParseTree getParseTree()
@Deprecated public static Template parse(java.lang.String input)
TemplateParser.parse(String)TemplateParser instead.input - the input string holding the Liquid source.@Deprecated public static Template parse(java.lang.String input, java.util.List<Insertion> insertions, java.util.List<Filter> filters)
TemplateParser.parse(String)TemplateParser instead.input - the input string holding the Liquid source.insertions - the list of insertions to use when parsing and rendering the templatefilters - the list of filters to use when parsing and rendering the template@Deprecated public static Template parse(java.io.File file) throws java.io.IOException
TemplateParser.parse(File)TemplateParser instead.file - the input file holding the Liquid source.java.io.IOException - on error.@Deprecated public static Template parse(java.io.File file, ParseSettings settings) throws java.io.IOException
TemplateParser.parse(File)TemplateParser instead.file - the input file holding the Liquid source.settings - the parse settings.java.io.IOException - on error.@Deprecated public static Template parse(java.lang.String input, ParseSettings settings)
TemplateParser.parse(String)TemplateParser instead.input - the input string holding the Liquid source.settings - the parse settings.@Deprecated public static Template parse(java.io.File file, ParseSettings parseSettings, RenderSettings renderSettings) throws java.io.IOException
TemplateParser.parse(File)TemplateParser instead.file - the input file holding the Liquid source.parseSettings - the parse settings.renderSettings - the render settings.java.io.IOException - on error.@Deprecated public static Template parse(java.lang.String input, ParseSettings parseSettings, RenderSettings renderSettings)
TemplateParser.parse(String)TemplateParser instead.input - the input string holding the Liquid source.parseSettings - the parse settings.renderSettings - the render settings.@Deprecated public static Template parse(java.io.InputStream input)
TemplateParser.parse(InputStream)TemplateParser instead. Additionally, IOExceptions are
converted to RuntimeException.input - the input stream holding the Liquid source.@Deprecated public static Template parse(java.io.InputStream input, ParseSettings settings)
TemplateParser.parse(InputStream)TemplateParser instead. Additionally, IOExceptions are
converted to RuntimeException.input - the input stream holding the Liquid source.settings - the parse 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.IOException@Deprecated public static Template parse(java.lang.String input, java.util.List<Insertion> insertions, java.util.List<Filter> filters, ParseSettings parseSettings, RenderSettings renderSettings)
TemplateParser.parse(InputStream)TemplateParser instead.@Deprecated public Template withProtectionSettings(ProtectionSettings settings)
TemplateParserProtectionSettings.
This method will fail with an UnsupportedOperationException exception if this instance has
been created from a TemplateParser.settings - The protection settings.@Deprecated public Template withRenderSettings(RenderSettings settings) throws java.lang.UnsupportedOperationException
TemplateParserRenderSettings.
This method will fail with an UnsupportedOperationException exception if this instance has
been created from a TemplateParser.settings - The render settings.java.lang.UnsupportedOperationExceptionpublic 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.Object renderToObject(java.lang.String jsonMap)
public java.lang.String render()
public java.lang.Object renderToObject()
public java.lang.String render(Inspectable object)
public java.lang.Object renderToObject(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.Object renderToObject(java.util.Map<java.lang.String,java.lang.Object> variables)
RenderTransformer), however calling Object.toString() on that object is guaranteed to be
equivalent to calling render(Map).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.Object renderToObjectUnguarded(java.util.Map<java.lang.String,java.lang.Object> variables)
RenderTransformer),
however calling Object.toString() on that object is guaranteed to be equivalent to calling
renderToObjectUnguarded(Map).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.Object renderToObjectUnguarded(java.util.Map<java.lang.String,java.lang.Object> variables,
TemplateContext parent,
boolean doClearThreadLocal)
public java.lang.String renderUnguarded(TemplateContext parent)
parent - The parent context.@Deprecated public java.lang.String toStringAST()
public java.lang.String toStringTree()
public ProtectionSettings getProtectionSettings()
public RenderSettings getRenderSettings()
public ParseSettings getParseSettings()
Copyright © 2012–2023. All rights reserved.