|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface SoyTofu
SoyTofu is the public interface for a Java object that represents a compiled Soy file set.
Important: Users should use the methods here (on a SoyTofu object created by Soy), but should not create their own implementations this interface.
| Nested Class Summary | |
|---|---|
static interface |
SoyTofu.Renderer
Renderer for a template. |
| Method Summary | |
|---|---|
void |
addToCache(SoyMsgBundle msgBundle,
SoyCssRenamingMap cssRenamingMap)
Primes the cache with the given combination of SoyMsgBundle and SoyCssRenamingMap. |
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). |
boolean |
isCaching()
Gets whether this instance caches intermediate Soy trees after substitutions from the SoyMsgBundle and the SoyCssRenamingMap. |
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,
Map<String,?> data,
SoyMsgBundle msgBundle)
Deprecated. Use newRenderer(SoyTemplateInfo). |
String |
render(SoyTemplateInfo templateInfo,
SoyMapData data,
SoyMsgBundle msgBundle)
Deprecated. Use newRenderer(SoyTemplateInfo). |
String |
render(String templateName,
Map<String,?> data,
SoyMsgBundle msgBundle)
Deprecated. Use newRenderer(String). |
String |
render(String templateName,
SoyMapData data,
SoyMsgBundle msgBundle)
Deprecated. Use newRenderer(String). |
| Method Detail |
|---|
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.
SoyTofu forNamespace(@Nullable
String namespace)
namespace - The namespace for the new SoyTofu instance, or null for no namespace.
boolean isCaching()
void addToCache(@Nullable
SoyMsgBundle msgBundle,
@Nullable
SoyCssRenamingMap cssRenamingMap)
isCaching() is true.
msgBundle - The message bundle to prime the cache with.cssRenamingMap - The CSS renaming map to prime the cache with.SoyTofu.Renderer newRenderer(SoyTemplateInfo templateInfo)
The usage pattern is soyTofu.newRenderer(...).setData(...).setInjectedData(...).setMsgBundle(...).render() where any of the set* parts can be omitted if it's null.
templateInfo - Info for the template to render.
SoyTofu.Renderer newRenderer(String templateName)
The usage pattern is soyTofu.newRenderer(...).setData(...).setInjectedData(...).setMsgBundle(...).render() where any of the set* parts can be omitted if it's null.
templateName - 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").
com.google.common.collect.ImmutableSortedSet<String> getUsedIjParamsForTemplate(SoyTemplateInfo templateInfo)
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.
templateInfo - Info for the template to get injected params of.
com.google.common.collect.ImmutableSortedSet<String> getUsedIjParamsForTemplate(String templateName)
templateName - The name of the template to get injected params of.
@Deprecated
String render(SoyTemplateInfo templateInfo,
@Nullable
Map<String,?> data,
@Nullable
SoyMsgBundle msgBundle)
newRenderer(SoyTemplateInfo).
Note: If you call this method instead of
render(SoyTemplateInfo, SoyMapData, SoyMsgBundle),
your template data will be converted to a SoyMapData 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 SoyMapData object
and reuse it with render(SoyTemplateInfo, SoyMapData, SoyMsgBundle).
templateInfo - 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
String render(SoyTemplateInfo templateInfo,
@Nullable
SoyMapData data,
@Nullable
SoyMsgBundle msgBundle)
newRenderer(SoyTemplateInfo).
templateInfo - 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
String render(String templateName,
@Nullable
Map<String,?> data,
@Nullable
SoyMsgBundle msgBundle)
newRenderer(String).
Note: If you call this method instead of render(String, SoyMapData, SoyMsgBundle),
your template data will be converted to a SoyMapData 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 SoyMapData object
and reuse it with render(String, SoyMapData, SoyMsgBundle).
templateName - 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
String render(String templateName,
@Nullable
SoyMapData data,
@Nullable
SoyMsgBundle msgBundle)
newRenderer(String).
templateName - 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.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||