com.samskivert.mustache
Class Mustache.Compiler

java.lang.Object
  extended by com.samskivert.mustache.Mustache.Compiler
Enclosing class:
Mustache

public static class Mustache.Compiler
extends java.lang.Object

An interface to the Mustache compilation process. See Mustache.


Field Summary
 boolean escapeHTML
          Whether or not HTML entities are escaped by default.
 Mustache.TemplateLoader loader
          The template loader in use during this compilation.
 boolean missingIsNull
          If this value is true, missing variables will be treated like variables that return null.
 java.lang.String nullValue
          A value to use when a variable resolves to null.
 boolean standardsMode
          Whether or not standards mode is enabled.
 
Method Summary
 Template compile(java.io.Reader source)
          Compiles the supplied template into a repeatedly executable intermediate form.
 Template compile(java.lang.String template)
          Compiles the supplied template into a repeatedly executable intermediate form.
 Mustache.Compiler defaultValue(java.lang.String defaultValue)
          Returns a compiler that will use the given value for any variable that is missing, or otherwise resolves to null.
 Mustache.Compiler escapeHTML(boolean escapeHTML)
          Returns a compiler that either does or does not escape HTML by default.
 Mustache.Compiler nullValue(java.lang.String nullValue)
          Returns a compiler that will use the given value for any variable that resolves to null, but will still raise an exception for variables for which an accessor cannot be found.
 Mustache.Compiler standardsMode(boolean standardsMode)
          Returns a compiler that either does or does not use standards mode.
 Mustache.Compiler withLoader(Mustache.TemplateLoader loader)
          Returns a compiler configured to use the supplied template loader to handle partials.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

escapeHTML

public final boolean escapeHTML
Whether or not HTML entities are escaped by default.


standardsMode

public final boolean standardsMode
Whether or not standards mode is enabled.


nullValue

public final java.lang.String nullValue
A value to use when a variable resolves to null. If this value is null (which is the default null value), an exception will be thrown. If missingIsNull is also true, this value will be used when a variable cannot be resolved.


missingIsNull

public final boolean missingIsNull
If this value is true, missing variables will be treated like variables that return null. nullValue will be used in their place, assuming nullValue is configured to a non-null value.


loader

public final Mustache.TemplateLoader loader
The template loader in use during this compilation.

Method Detail

compile

public Template compile(java.lang.String template)
Compiles the supplied template into a repeatedly executable intermediate form.


compile

public Template compile(java.io.Reader source)
Compiles the supplied template into a repeatedly executable intermediate form.


escapeHTML

public Mustache.Compiler escapeHTML(boolean escapeHTML)
Returns a compiler that either does or does not escape HTML by default.


standardsMode

public Mustache.Compiler standardsMode(boolean standardsMode)
Returns a compiler that either does or does not use standards mode. Standards mode disables the non-standard JMustache extensions like looking up missing names in a parent context.


defaultValue

public Mustache.Compiler defaultValue(java.lang.String defaultValue)
Returns a compiler that will use the given value for any variable that is missing, or otherwise resolves to null. This is like nullValue except that it returns the supplied default for missing keys and existing keys that return null values. Note that regardless of whether a null or default value is configured, if the resolution of part of a compound key results in a missing or null value, an exception will be raised.


nullValue

public Mustache.Compiler nullValue(java.lang.String nullValue)
Returns a compiler that will use the given value for any variable that resolves to null, but will still raise an exception for variables for which an accessor cannot be found. This is like defaultValue(java.lang.String) except that it differentiates between missing accessors, and accessors that exist but return null. Note that regardless of whether a null or default value is configured, if the resolution of part of a compound key results in a missing or null value, an exception will be raised.


withLoader

public Mustache.Compiler withLoader(Mustache.TemplateLoader loader)
Returns a compiler configured to use the supplied template loader to handle partials.



Copyright © 2011. All Rights Reserved.