|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public static interface SoyTofu.Renderer
Renderer for a template.
| Method Summary | |
|---|---|
String |
render()
Renders the template using the data, injected data, and message bundle previously set. |
void |
render(Appendable out)
Renders the template using the data, injected data, and message bundle previously set into the given Appendable. |
SanitizedContent |
renderAsSanitizedContent()
Renders the strict-mode template as a SanitizedContent object, which can be used as an input to another Soy template, or used to verify that the output type is correct. |
SoyTofu.Renderer |
setActiveDelegatePackageNames(Set<String> activeDelegatePackageNames)
Sets the set of active delegate package names. |
SoyTofu.Renderer |
setCssRenamingMap(SoyCssRenamingMap cssRenamingMap)
Sets the CSS renaming map. |
SoyTofu.Renderer |
setData(Map<String,?> data)
Sets the data to call the template with. |
SoyTofu.Renderer |
setData(SoyMapData data)
Sets the data to call the template with. |
SoyTofu.Renderer |
setDontAddToCache(boolean dontAddToCache)
If set to true, indicates that we should not add the current combination of SoyMsgBundle and SoyCssRenamingMap to the cache if it's not already there. |
SoyTofu.Renderer |
setIjData(Map<String,?> ijData)
Sets the injected data to call the template with. |
SoyTofu.Renderer |
setIjData(SoyMapData ijData)
Sets the injected data to call the template with. |
SoyTofu.Renderer |
setMsgBundle(SoyMsgBundle msgBundle)
Sets the bundle of translated messages, or null to use the messages from the Soy source. |
| Method Detail |
|---|
SoyTofu.Renderer setData(Map<String,?> data)
Note: If you call this method instead of setData(SoyMapData), 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 setData(SoyMapData).
SoyTofu.Renderer setData(SoyMapData data)
SoyTofu.Renderer setIjData(Map<String,?> ijData)
Note: If you call this method instead of setIjData(SoyMapData), the 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 setIjData(SoyMapData).
SoyTofu.Renderer setIjData(SoyMapData ijData)
SoyTofu.Renderer setActiveDelegatePackageNames(Set<String> activeDelegatePackageNames)
SoyTofu.Renderer setMsgBundle(SoyMsgBundle msgBundle)
SoyTofu.Renderer setCssRenamingMap(SoyCssRenamingMap cssRenamingMap)
SoyTofu.Renderer setDontAddToCache(boolean dontAddToCache)
SoyMsgBundle and SoyCssRenamingMap to the cache if it's not already there.
Only applicable when the associated SoyTofu instance uses caching. Default value is
false, i.e. by default we always add to cache when not already present.
Specifically, if dontAddToCache is set to true, then after checking the cache for
the current combination of SoyMsgBundle and SoyCssRenamingMap:
(a) if found in cache, we will use the cached intermediate results for faster rendering,
(b) if not found in cache, we will fall back to the no-caching method of rendering.
If your app uses many different SoyMsgBundles or SoyCssRenamingMaps and
you're finding that the caching mode of SoyTofu is using too much memory, one
strategy may be to first prime the cache with the most common combinations by calling
SoyTofu.addToCache(com.google.template.soy.msgs.SoyMsgBundle, com.google.template.soy.shared.SoyCssRenamingMap), and then when rendering, always setDontAddToCache(true).
This way, most of your renders will use the cached results, yet your cache will never grow
beyond the size that you initially primed it to be.
String render()
SanitizedContent renderAsSanitizedContent()
IllegalArgumentException - If the template is non-strict.void render(Appendable out)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||