| Modifier and Type | Class and Description |
|---|---|
static interface |
BaseTofu.BaseTofuFactory
Injectable factory for creating an instance of this class.
|
SoyTofu.Renderer| Constructor and Description |
|---|
BaseTofu(SoyValueHelper valueHelper,
GuiceSimpleScope apiCallScope,
com.google.template.soy.tofu.internal.TofuRenderVisitorFactory tofuRenderVisitorFactory,
TemplateRegistry templates,
com.google.common.collect.ImmutableMap<String,com.google.common.collect.ImmutableSortedSet<String>> templateToIjParamsInfoMap,
com.google.common.collect.ImmutableMap<String,? extends SoyPrintDirective> printDirectives) |
| Modifier and Type | Method and Description |
|---|---|
SoyTofu |
forNamespace(String namespace)
Gets a new SoyTofu instance with a different namespace (or no namespace).
|
String |
getNamespace()
Gets the namespace of this SoyTofu object.
|
com.google.common.collect.ImmutableSortedSet<String> |
getUsedIjParamsForTemplate(SoyTemplateInfo templateInfo)
Gets the set of injected param keys used by a template (and its transitive callees).
|
com.google.common.collect.ImmutableSortedSet<String> |
getUsedIjParamsForTemplate(String templateName)
Gets the set of injected param keys used by a template (and its transitive callees).
|
SoyTofu.Renderer |
newRenderer(SoyTemplateInfo templateInfo)
Gets a new Renderer for a template.
|
SoyTofu.Renderer |
newRenderer(String templateName)
Gets a new Renderer for a template.
|
String |
render(SoyTemplateInfo templateInfo,
SoyRecord data,
SoyMsgBundle msgBundle)
Deprecated.
|
String |
render(String templateName,
Map<String,?> data,
SoyMsgBundle msgBundle)
Deprecated.
|
String |
render(String templateName,
SoyRecord data,
SoyMsgBundle msgBundle)
Deprecated.
|
public BaseTofu(SoyValueHelper valueHelper, GuiceSimpleScope apiCallScope, com.google.template.soy.tofu.internal.TofuRenderVisitorFactory tofuRenderVisitorFactory, TemplateRegistry templates, com.google.common.collect.ImmutableMap<String,com.google.common.collect.ImmutableSortedSet<String>> templateToIjParamsInfoMap, com.google.common.collect.ImmutableMap<String,? extends SoyPrintDirective> printDirectives)
valueHelper - Instance of SoyValueHelper to use.apiCallScope - The scope object that manages the API call scope.tofuRenderVisitorFactory - Factory for creating an instance of TofuRenderVisitor.public String getNamespace()
newRenderer() to be called with a partial template name (e.g. ".fooTemplate").
Note: The namespace may be null, in which case newRenderer() must be called with the
full template name.
For objects of this class, the namespace is always null.
getNamespace in interface SoyTofupublic SoyTofu forNamespace(@Nullable String namespace)
SoyTofuforNamespace in interface SoyTofunamespace - The namespace for the new SoyTofu instance, or null for no namespace.public SoyTofu.Renderer newRenderer(SoyTemplateInfo templateInfo)
SoyTofuThe usage pattern is soyTofu.newRenderer(...).setData(...).setInjectedData(...).setMsgBundle(...).render() where any of the set* parts can be omitted if it's null.
newRenderer in interface SoyTofutemplateInfo - Info for the template to render.public SoyTofu.Renderer newRenderer(String templateName)
SoyTofuThe usage pattern is soyTofu.newRenderer(...).setData(...).setInjectedData(...).setMsgBundle(...).render() where any of the set* parts can be omitted if it's null.
newRenderer in interface SoyTofutemplateName - The name of the template to render. If this SoyTofu instance is not
namespaced, then this parameter should be the full name of the template including the
namespace. If this SoyTofu instance is namespaced, then this parameter should be a partial
name beginning with a dot (e.g. ".fooTemplate").public com.google.common.collect.ImmutableSortedSet<String> getUsedIjParamsForTemplate(SoyTemplateInfo templateInfo)
SoyTofu Note: The SoyTemplateInfo object already has a method getUsedIjParams().
That method should produce the same results as this method, unless the bundle of Soy files
included when running the SoyParseInfoGenerator is different from the bundle of Soy files
included when creating this SoyTofu object.
getUsedIjParamsForTemplate in interface SoyTofutemplateInfo - Info for the template to get injected params of.public com.google.common.collect.ImmutableSortedSet<String> getUsedIjParamsForTemplate(String templateName)
SoyTofugetUsedIjParamsForTemplate in interface SoyTofutemplateName - The name of the template to get injected params of.@Deprecated public String render(SoyTemplateInfo templateInfo, @Nullable SoyRecord data, @Nullable SoyMsgBundle msgBundle)
SoyTofurender in interface SoyTofutemplateInfo - Info for the template to render.data - The data to call the template with. Can be null if the template has no parameters.msgBundle - The bundle of translated messages, or null to use the messages from the
Soy source.@Deprecated public String render(String templateName, @Nullable Map<String,?> data, @Nullable SoyMsgBundle msgBundle)
SoyTofu Note: If you call this method instead of SoyTofu.render(String, SoyRecord, SoyMsgBundle),
your template data will be converted to a SoyRecord object on each call. This may not
be a big deal if you only need to use the data object once. But if you need to reuse the same
data object for multiple calls, it's more efficient to build your own SoyRecord object
and reuse it with SoyTofu.render(String, SoyRecord, SoyMsgBundle).
render in interface SoyTofutemplateName - The name of the template to render. If this SoyTofu instance is namespaced,
then this parameter should be a partial name beginning with a dot (e.g. ".fooTemplate").data - The data to call the template with. Can be null if the template has no parameters.msgBundle - The bundle of translated messages, or null to use the messages from the
Soy source.@Deprecated public String render(String templateName, @Nullable SoyRecord data, @Nullable SoyMsgBundle msgBundle)
SoyTofurender in interface SoyTofutemplateName - The name of the template to render. If this SoyTofu instance is namespaced,
then this parameter should be a partial name beginning with a dot (e.g. ".fooTemplate").data - The data to call the template with. Can be null if the template has no parameters.msgBundle - The bundle of translated messages, or null to use the messages from the
Soy source.