com.google.template.soy.jssrc
Class SoyJsSrcOptions

java.lang.Object
  extended by com.google.template.soy.jssrc.SoyJsSrcOptions
All Implemented Interfaces:
Cloneable

public class SoyJsSrcOptions
extends Object
implements Cloneable

Compilation options for the JS Src output target (backend).


Nested Class Summary
static class SoyJsSrcOptions.CodeStyle
          The two supported code styles.
 
Constructor Summary
SoyJsSrcOptions()
           
 
Method Summary
 SoyJsSrcOptions clone()
           
 int getBidiGlobalDir()
          Returns the static bidi global directionality, 1: ltr, -1: rtl, 0: unspecified.
 SoyJsSrcOptions.CodeStyle getCodeStyle()
          Returns the currently set code style.
 boolean getUseGoogIsRtlForBidiGlobalDir()
          Returns whether to determine the bidi global direction at template runtime by evaluating goog.i18n.bidi.IS_RTL.
 boolean googMsgsAreExternal()
          Returns whether the generated Closure Library message definitions are for external messages (only applicable if shouldGenerateGoogMsgDefs is true).
 boolean isUsingIjData()
          Returns whether use of injected data is currently enabled.
 void setBidiGlobalDir(int bidiGlobalDir)
          Sets the bidi global directionality to a static value, 1: ltr, -1: rtl, 0: unspecified.
 void setCodeStyle(SoyJsSrcOptions.CodeStyle codeStyle)
          Sets the output variable code style to use.
 void setGoogMsgsAreExternal(boolean googMsgsAreExternal)
          Sets whether the generated Closure Library message definitions are for external messages (only applicable if shouldGenerateGoogMsgDefs is true).
 void setIsUsingIjData(boolean isUsingIjData)
          Sets whether to enable use of injected data (syntax is '$ij.*').
 void setShouldAllowDeprecatedSyntax(boolean shouldAllowDeprecatedSyntax)
          Sets whether to allow deprecated syntax (semi backwards compatible mode).
 void setShouldDeclareTopLevelNamespaces(boolean shouldDeclareTopLevelNamespaces)
          Sets whether we should generate code to declare the top level namespace.
 void setShouldGenerateGoogMsgDefs(boolean shouldGenerateGoogMsgDefs)
          Sets whether we should generate Closure Library message definitions (i.e.
 void setShouldGenerateJsdoc(boolean shouldGenerateJsdoc)
          Sets whether we should generate JSDoc with type info for the Closure Compiler.
 void setShouldProvideBothSoyNamespacesAndJsFunctions(boolean shouldProvideBothSoyNamespacesAndJsFunctions)
          Sets whether we should generate code to provide both Soy namespaces and JS functions.
 void setShouldProvideRequireJsFunctions(boolean shouldProvideRequireJsFunctions)
          Sets whether we should generate code to provide/require template JS functions.
 void setShouldProvideRequireSoyNamespaces(boolean shouldProvideRequireSoyNamespaces)
          Sets whether we should generate code to provide/require Soy namespaces.
 void setUseGoogIsRtlForBidiGlobalDir(boolean useGoogIsRtlForBidiGlobalDir)
          Sets the Javascript code snippet that will evaluate at template runtime to a boolean value indicating whether the bidi global direction is rtl.
 boolean shouldAllowDeprecatedSyntax()
          Returns whether we're set to allow deprecated syntax (semi backwards compatible mode).
 boolean shouldDeclareTopLevelNamespaces()
          Returns whether we should attempt to declare the top level namespace.
 boolean shouldGenerateGoogMsgDefs()
          Returns whether we should generate Closure Library message definitions (i.e.
 boolean shouldGenerateJsdoc()
          Returns whether we should generate JSDoc with type info for the Closure Compiler.
 boolean shouldProvideBothSoyNamespacesAndJsFunctions()
          Returns whether we should generate code to provide both Soy namespaces and JS functions.
 boolean shouldProvideRequireJsFunctions()
          Returns whether we're set to generate code to provide/require template JS functions.
 boolean shouldProvideRequireSoyNamespaces()
          Returns whether we're set to generate code to provide/require Soy namespaces.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SoyJsSrcOptions

public SoyJsSrcOptions()
Method Detail

setShouldAllowDeprecatedSyntax

public void setShouldAllowDeprecatedSyntax(boolean shouldAllowDeprecatedSyntax)
Sets whether to allow deprecated syntax (semi backwards compatible mode).

Parameters:
shouldAllowDeprecatedSyntax - The value to set.

shouldAllowDeprecatedSyntax

public boolean shouldAllowDeprecatedSyntax()
Returns whether we're set to allow deprecated syntax (semi backwards compatible mode).


setIsUsingIjData

public void setIsUsingIjData(boolean isUsingIjData)
Sets whether to enable use of injected data (syntax is '$ij.*').

Parameters:
isUsingIjData - The code style to set.

isUsingIjData

public boolean isUsingIjData()
Returns whether use of injected data is currently enabled.


setCodeStyle

public void setCodeStyle(SoyJsSrcOptions.CodeStyle codeStyle)
Sets the output variable code style to use.

Parameters:
codeStyle - The code style to set.

getCodeStyle

public SoyJsSrcOptions.CodeStyle getCodeStyle()
Returns the currently set code style.


setShouldGenerateJsdoc

public void setShouldGenerateJsdoc(boolean shouldGenerateJsdoc)
Sets whether we should generate JSDoc with type info for the Closure Compiler.

Parameters:
shouldGenerateJsdoc - The value to set.

shouldGenerateJsdoc

public boolean shouldGenerateJsdoc()
Returns whether we should generate JSDoc with type info for the Closure Compiler.


setShouldProvideRequireSoyNamespaces

public void setShouldProvideRequireSoyNamespaces(boolean shouldProvideRequireSoyNamespaces)
Sets whether we should generate code to provide/require Soy namespaces.

Parameters:
shouldProvideRequireSoyNamespaces - The value to set.

shouldProvideRequireSoyNamespaces

public boolean shouldProvideRequireSoyNamespaces()
Returns whether we're set to generate code to provide/require Soy namespaces.


setShouldProvideRequireJsFunctions

public void setShouldProvideRequireJsFunctions(boolean shouldProvideRequireJsFunctions)
Sets whether we should generate code to provide/require template JS functions.

Parameters:
shouldProvideRequireJsFunctions - The value to set.

shouldProvideRequireJsFunctions

public boolean shouldProvideRequireJsFunctions()
Returns whether we're set to generate code to provide/require template JS functions.


setShouldProvideBothSoyNamespacesAndJsFunctions

public void setShouldProvideBothSoyNamespacesAndJsFunctions(boolean shouldProvideBothSoyNamespacesAndJsFunctions)
Sets whether we should generate code to provide both Soy namespaces and JS functions.

Parameters:
shouldProvideBothSoyNamespacesAndJsFunctions - The value to set.

shouldProvideBothSoyNamespacesAndJsFunctions

public boolean shouldProvideBothSoyNamespacesAndJsFunctions()
Returns whether we should generate code to provide both Soy namespaces and JS functions.


setShouldDeclareTopLevelNamespaces

public void setShouldDeclareTopLevelNamespaces(boolean shouldDeclareTopLevelNamespaces)
Sets whether we should generate code to declare the top level namespace.

Parameters:
shouldDeclareTopLevelNamespaces - The value to set.

shouldDeclareTopLevelNamespaces

public boolean shouldDeclareTopLevelNamespaces()
Returns whether we should attempt to declare the top level namespace.


setShouldGenerateGoogMsgDefs

public void setShouldGenerateGoogMsgDefs(boolean shouldGenerateGoogMsgDefs)
Sets whether we should generate Closure Library message definitions (i.e. goog.getMsg).

Parameters:
shouldGenerateGoogMsgDefs - The value to set.

shouldGenerateGoogMsgDefs

public boolean shouldGenerateGoogMsgDefs()
Returns whether we should generate Closure Library message definitions (i.e. goog.getMsg).


setGoogMsgsAreExternal

public void setGoogMsgsAreExternal(boolean googMsgsAreExternal)
Sets whether the generated Closure Library message definitions are for external messages (only applicable if shouldGenerateGoogMsgDefs is true). If this option is true, then we generate var MSG_EXTERNAL_[soyGeneratedMsgId] = goog.getMsg(...); If this option is false, then we generate var MSG_UNNAMED_[uniquefier] = goog.getMsg(...);

Parameters:
googMsgsAreExternal - The value to set.

googMsgsAreExternal

public boolean googMsgsAreExternal()
Returns whether the generated Closure Library message definitions are for external messages (only applicable if shouldGenerateGoogMsgDefs is true). If this option is true, then we generate var MSG_EXTERNAL_[soyGeneratedMsgId] = goog.getMsg(...); If this option is false, then we generate var MSG_UNNAMED_[uniquefier] = goog.getMsg(...);


setBidiGlobalDir

public void setBidiGlobalDir(int bidiGlobalDir)
Sets the bidi global directionality to a static value, 1: ltr, -1: rtl, 0: unspecified. If 0, and useGoogIsRtlForBidiGlobalDir is false, the bidi global directionality will actually be inferred from the message bundle locale. This is the recommended mode of operation when shouldGenerateGoogMsgDefs is false. When shouldGenerateGoogMsgDefs is true, the bidi global direction can not be left unspecified, but the recommended way of doing so is via setUseGoogIsRtlForBidiGlobalDir(true). Thus, whether shouldGenerateGoogMsgDefs is true or not, THERE IS USUALLY NO NEED TO USE THIS METHOD!

Parameters:
bidiGlobalDir - 1: ltr, -1: rtl, 0: unspecified. Checks that no other value is used.

getBidiGlobalDir

public int getBidiGlobalDir()
Returns the static bidi global directionality, 1: ltr, -1: rtl, 0: unspecified.


setUseGoogIsRtlForBidiGlobalDir

public void setUseGoogIsRtlForBidiGlobalDir(boolean useGoogIsRtlForBidiGlobalDir)
Sets the Javascript code snippet that will evaluate at template runtime to a boolean value indicating whether the bidi global direction is rtl. Can only be used when shouldGenerateGoogMsgDefs is true.

Parameters:
useGoogIsRtlForBidiGlobalDir - Whether to determine the bidi global direction at template runtime by evaluating goog.i18n.bidi.IS_RTL.

getUseGoogIsRtlForBidiGlobalDir

public boolean getUseGoogIsRtlForBidiGlobalDir()
Returns whether to determine the bidi global direction at template runtime by evaluating goog.i18n.bidi.IS_RTL. May only be true when shouldGenerateGoogMsgDefs is true.


clone

public SoyJsSrcOptions clone()
Overrides:
clone in class Object