com.google.template.soy.shared
Class SoyGeneralOptions

java.lang.Object
  extended by com.google.template.soy.shared.SoyGeneralOptions
All Implemented Interfaces:
Cloneable

public class SoyGeneralOptions
extends Object
implements Cloneable

Compilation options applicable to the Soy frontend and/or to multiple Soy backends.


Nested Class Summary
static class SoyGeneralOptions.CssHandlingScheme
          Schemes for handling css commands.
 
Constructor Summary
SoyGeneralOptions()
           
 
Method Summary
 Boolean allowExternalCalls()
          Returns whether to allow external calls (calls to undefined templates).
 SoyGeneralOptions clone()
           
 com.google.common.collect.ImmutableMap<String,com.google.template.soy.data.restricted.PrimitiveData> getCompileTimeGlobals()
          Returns the map from compile-time global name to value.
 SoyGeneralOptions.CssHandlingScheme getCssHandlingScheme()
          Returns the scheme for handling css commands.
 void setAllowExternalCalls(boolean allowExternalCalls)
          Sets whether to allow external calls (calls to undefined templates).
 void setCompileTimeGlobals(File compileTimeGlobalsFile)
          Sets the file containing compile-time globals.
 void setCompileTimeGlobals(Map<String,?> compileTimeGlobalsMap)
          Sets the map from compile-time global name to value.
 void setCompileTimeGlobals(URL compileTimeGlobalsResource)
          Sets the resource file containing compile-time globals.
 void setCssHandlingScheme(SoyGeneralOptions.CssHandlingScheme cssHandlingScheme)
          Sets the scheme for handling css commands.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SoyGeneralOptions

public SoyGeneralOptions()
Method Detail

setAllowExternalCalls

public void setAllowExternalCalls(boolean allowExternalCalls)
Sets whether to allow external calls (calls to undefined templates).

Parameters:
allowExternalCalls - The value to set.

allowExternalCalls

public Boolean allowExternalCalls()
Returns whether to allow external calls (calls to undefined templates). If this option was never explicitly set, then returns null.


setCssHandlingScheme

public void setCssHandlingScheme(SoyGeneralOptions.CssHandlingScheme cssHandlingScheme)
Sets the scheme for handling css commands.

Parameters:
cssHandlingScheme - The css-handling scheme to set.

getCssHandlingScheme

public SoyGeneralOptions.CssHandlingScheme getCssHandlingScheme()
Returns the scheme for handling css commands.


setCompileTimeGlobals

public void setCompileTimeGlobals(Map<String,?> compileTimeGlobalsMap)
Sets the map from compile-time global name to value.

The values can be any of the Soy primitive types: null, boolean, integer, float (Java double), or string.

Parameters:
compileTimeGlobalsMap - Map from compile-time global name to value. The values can be any of the Soy primitive types: null, boolean, integer, float (Java double), or string.
Throws:
SoySyntaxException - If one of the values is not a valid Soy primitive type.

setCompileTimeGlobals

public void setCompileTimeGlobals(File compileTimeGlobalsFile)
                           throws IOException
Sets the file containing compile-time globals.

Each line of the file should have the format

     <global_name> = <primitive_data>
 
where primitive_data is a valid Soy expression literal for a primitive type (null, boolean, integer, float, or string). Empty lines and lines beginning with "//" are ignored. The file should be encoded in UTF-8.

If you need to generate a file in this format from Java, consider using the utility SoyUtils.generateCompileTimeGlobalsFile().

Parameters:
compileTimeGlobalsFile - The file containing compile-time globals.
Throws:
IOException - If there is an error reading the compile-time globals file.

setCompileTimeGlobals

public void setCompileTimeGlobals(URL compileTimeGlobalsResource)
                           throws IOException
Sets the resource file containing compile-time globals.

Each line of the file should have the format

     <global_name> = <primitive_data>
 
where primitive_data is a valid Soy expression literal for a primitive type (null, boolean, integer, float, or string). Empty lines and lines beginning with "//" are ignored. The file should be encoded in UTF-8.

If you need to generate a file in this format from Java, consider using the utility SoyUtils.generateCompileTimeGlobalsFile().

Parameters:
compileTimeGlobalsResource - The resource file containing compile-time globals.
Throws:
IOException - If there is an error reading the compile-time globals file.

getCompileTimeGlobals

public com.google.common.collect.ImmutableMap<String,com.google.template.soy.data.restricted.PrimitiveData> getCompileTimeGlobals()
Returns the map from compile-time global name to value.


clone

public SoyGeneralOptions clone()
Overrides:
clone in class Object