|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.google.template.soy.SoyFileSet
public final class SoyFileSet
Represents a complete set of Soy files for compilation as one bundle. The files may depend on each other but should not have dependencies outside of the set.
Note: Soy file (or resource) contents must be encoded in UTF-8.
| Nested Class Summary | |
|---|---|
static class |
SoyFileSet.Builder
Builder for a SoyFileSet. |
| Method Summary | |
|---|---|
SoyTofu |
compileToJavaObj()
Deprecated. Use compileToTofu(). |
SoyTofu |
compileToJavaObj(boolean useCaching)
Deprecated. Use compileToTofu(com.google.template.soy.tofu.SoyTofuOptions). |
String |
compileToJavaSrc(SoyJavaSrcOptions javaSrcOptions,
SoyMsgBundle msgBundle)
Warning: The Java Src backend is experimental (incomplete, repetitive, untested, undocumented). |
List<String> |
compileToJsSrc(SoyJsSrcOptions jsSrcOptions,
SoyMsgBundle msgBundle)
Compiles this Soy file set into JS source code files and returns these JS files as a list of strings, one per file. |
SoyTemplateRuntimes |
compileToRuntimes(String bundleName,
SoyJavaSrcOptions options,
SoyMsgBundle msgBundle)
Warning: The Java Src backend is experimental (incomplete, repetitive, untested, undocumented). |
SoyTofu |
compileToTofu()
Compiles this Soy file set into a Java object (type SoyTofu) capable of rendering the
compiled templates. |
SoyTofu |
compileToTofu(SoyTofuOptions tofuOptions)
Compiles this Soy file set into a Java object (type SoyTofu) capable of rendering the
compiled templates. |
SoyMsgBundle |
extractMsgs()
Extracts all messages from this Soy file set into a SoyMsgBundle (which can then be turned into an extracted messages file with the help of a SoyMsgBundleHandler). |
com.google.common.collect.ImmutableMap<String,String> |
generateParseInfo(String javaPackage,
String javaClassNameSource)
Generates Java classes containing parse info (param names, template names, meta info). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public com.google.common.collect.ImmutableMap<String,String> generateParseInfo(String javaPackage,
String javaClassNameSource)
throws SoySyntaxException
javaPackage - The Java package for the generated classes.javaClassNameSource - Source of the generated class names. Must be one of "filename",
"namespace", or "generic".
SoySyntaxException - If a syntax error is found.
public SoyMsgBundle extractMsgs()
throws SoySyntaxException
SoySyntaxException - If a syntax error is found.
public SoyTofu compileToTofu()
throws SoySyntaxException
SoyTofu) capable of rendering the
compiled templates. The resulting SoyTofu does not cache intermediate results after
substitutions from the SoyMsgBundle and the SoyCssRenamingMap.
SoyTofu object.
SoySyntaxException - If a syntax error is found.compileToTofu(com.google.template.soy.tofu.SoyTofuOptions)
public SoyTofu compileToTofu(SoyTofuOptions tofuOptions)
throws SoySyntaxException
SoyTofu) capable of rendering the
compiled templates.
tofuOptions - The compilation options for the Tofu backend.
SoyTofu object.
SoySyntaxException - If a syntax error is found.
@Deprecated
public SoyTofu compileToJavaObj()
throws SoySyntaxException
compileToTofu().
SoyTofu) capable of rendering the
compiled templates. The resulting SoyTofu does not cache intermediate results after
substitutions from the SoyMsgBundle and the SoyCssRenamingMap.
SoySyntaxException - If a syntax error is found.compileToTofu()
@Deprecated
public SoyTofu compileToJavaObj(boolean useCaching)
throws SoySyntaxException
compileToTofu(com.google.template.soy.tofu.SoyTofuOptions).
SoyTofu) capable of rendering the
compiled templates.
useCaching - Whether the resulting SoyTofu instance should cache intermediate results
after substitutions from the SoyMsgBundle and the SoyCssRenamingMap. It is recommended to
set this param to true if you're planning to reuse the SoyTofu instance to render multiple
times.
Specifically, if this param is set to true, then
(a) The first time the SoyTofu is used with a new combination of SoyMsgBundle and
SoyCssRenamingMap, the render will be slower. (Note that this first-render slowness can
be eliminated by calling the method SoyTofu.addToCache(com.google.template.soy.msgs.SoyMsgBundle, com.google.template.soy.shared.SoyCssRenamingMap) to prime the cache.)
(b) The subsequent times the SoyTofu is used with an already-seen combination of
SoyMsgBundle and SoyCssRenamingMap, the render will be faster.
The cache will use memory proportional to the number of distinct combinations of
SoyMsgBundle and SoyCssRenamingMap your app uses (note most apps have at most one
SoyCssRenamingMap). If you find memory usage to be a problem, you can manually control the
contents of the cache. See SoyTofu.Renderer#setDontAddToCache for details.
SoySyntaxException - If a syntax error is found.compileToTofu(com.google.template.soy.tofu.SoyTofuOptions)
public SoyTemplateRuntimes compileToRuntimes(String bundleName,
SoyJavaSrcOptions options,
SoyMsgBundle msgBundle)
Returns a bundle of templates compiled using the experimental java compiler that will be automatically recompiled if the underlying Soy sources are modified.
public String compileToJavaSrc(SoyJavaSrcOptions javaSrcOptions,
SoyMsgBundle msgBundle)
To use Soy from Java, you should call compileToTofu() to obtain a
SoyTofu object that will be able to render any public template in this Soy file set.
javaSrcOptions - The compilation options for the Java Src output target.msgBundle - The bundle of translated messages, or null to use the messages from the Soy
source.
public List<String> compileToJsSrc(SoyJsSrcOptions jsSrcOptions,
@Nullable
SoyMsgBundle msgBundle)
throws SoySyntaxException
jsSrcOptions - The compilation options for the JS Src output target.msgBundle - The bundle of translated messages, or null to use the messages from the Soy
source.
SoySyntaxException - If a syntax error is found.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||