Package: groovy.text.markup

## [Java] Class TemplateConfiguration

- groovy.text.markup.TemplateConfiguration

-     public class TemplateConfiguration
      extends Object

  Configuration options for the markup template engine.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `TemplateConfiguration()` Creates a configuration instance with default markup template settings.
    `TemplateConfiguration(TemplateConfiguration that)` Creates a configuration by copying values from another instance.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public String` | `getAutoIndentString()` Returns the indentation unit inserted when automatic indentation is enabled.
    `` | `public Class<? extends BaseTemplate>` | `getBaseTemplateClass()` Returns the base class used for generated template scripts.
    `` | `public String` | `getDeclarationEncoding()` Returns: the encoding used in the declaration header
    `` | `public Locale` | `getLocale()` Returns the locale used when resolving localized templates.
    `` | `public String` | `getNewLineString()` Returns the line separator inserted by BaseTemplate.newLine.
    `` | `public boolean` | `isAutoEscape()` Returns: true if variables in the model which are assignable to CharSequence should be automatically escaped.
    `` | `public boolean` | `isAutoIndent()` Returns: true if the template engine should handle indents automatically
    `` | `public boolean` | `isAutoNewLine()` Indicates whether source layout should automatically insert line separators.
    `` | `public boolean` | `isCacheTemplates()` Indicates whether templates resolved from external resources are cached.
    `` | `public boolean` | `isExpandEmptyElements()` Returns: whether elements without body should be written in the short form (ex: <br/>) or in an expanded form (ex: <br></br>)
    `` | `public boolean` | `isUseDoubleQuotes()` Returns: true if attributes should use double quotes instead of single quotes
    `` | `public void` | `setAutoEscape(boolean autoEscape)` Set to true if you want variables in the model which are assignable to CharSequence to be escaped automatically in templates.
    `` | `public void` | `setAutoIndent(boolean autoIndent)` Set this to true if you want the template engine to render indents automatically.
    `` | `public void` | `setAutoIndentString(String autoIndentString)` Sets the indentation unit inserted when automatic indentation is enabled.
    `` | `public void` | `setAutoNewLine(boolean autoNewLine)` Sets whether source layout should automatically insert line separators.
    `` | `public void` | `setBaseTemplateClass(Class<? extends BaseTemplate> baseTemplateClass)` Set the template base class.
    `` | `public void` | `setCacheTemplates(boolean cacheTemplates)` If cache is enabled, then templates are compiled once for each source (URL or File).
    `` | `public void` | `setDeclarationEncoding(String declarationEncoding)` Set the encoding used to write the declaration header.
    `` | `public void` | `setExpandEmptyElements(boolean expandEmptyElements)` Sets whether empty elements should be expanded into explicit opening and closing tags.
    `` | `public void` | `setLocale(Locale locale)` Sets the locale used when resolving localized templates.
    `` | `public void` | `setNewLineString(String newLineString)` Sets the line separator inserted by BaseTemplate.newLine.
    `` | `public void` | `setUseDoubleQuotes(boolean useDoubleQuotes)` Sets whether attributes should be rendered with double quotes.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### public TemplateConfiguration()

      Creates a configuration instance with default markup template settings.

    - #### public TemplateConfiguration(TemplateConfiguration that)

      Creates a configuration by copying values from another instance.

      Parameters:
        `that` - configuration to copy

  - ### Method Detail

    - #### public String getAutoIndentString()

      Returns the indentation unit inserted when automatic indentation is enabled.

      Returns:
        the indentation unit string

    - #### public Class<? extends BaseTemplate> getBaseTemplateClass()

      Returns the base class used for generated template scripts.

      Returns:
        the configured base template class

    - #### public String getDeclarationEncoding()

      Returns:
        the encoding used in the declaration header

    - #### public Locale getLocale()

      Returns the locale used when resolving localized templates.

      Returns:
        the configured template locale

    - #### public String getNewLineString()

      Returns the line separator inserted by BaseTemplate.newLine.

      Returns:
        the configured line separator

    - #### public boolean isAutoEscape()

      Returns:
        true if variables in the model which are assignable to CharSequence should be automatically escaped.

    - #### public boolean isAutoIndent()

      Returns:
        true if the template engine should handle indents automatically

    - #### public boolean isAutoNewLine()

      Indicates whether source layout should automatically insert line separators.

      Returns:
        `true` if builder blocks automatically emit new lines

    - #### public boolean isCacheTemplates()

      Indicates whether templates resolved from external resources are cached.

      Returns:
        `true` if template compilation results may be reused

    - #### public boolean isExpandEmptyElements()

      Returns:
        whether elements without body should be written in the short form (ex: <br/>) or in an expanded form (ex: <br></br>)

    - #### public boolean isUseDoubleQuotes()

      Returns:
        true if attributes should use double quotes instead of single quotes

    - #### public void setAutoEscape(boolean autoEscape)

      Set to true if you want variables in the model which are assignable to CharSequence to be escaped automatically in templates. If this flag is set to true and that you want a value not to be automatically escaped, then you need to use ${unescaped.variable} instead of $variable

      Parameters:
        `autoEscape` - value if the autoEscape flag

    - #### public void setAutoIndent(boolean autoIndent)

      Set this to true if you want the template engine to render indents automatically. In that case, the supplied writer is wrapped into a DelegatingIndentWriter and indents are inserted after each call to newLine.

      Parameters:
        `autoIndent` - the auto-indent flag

    - #### public void setAutoIndentString(String autoIndentString)

      Sets the indentation unit inserted when automatic indentation is enabled.

      Parameters:
        `autoIndentString` - indentation unit to write for each nesting level

    - #### public void setAutoNewLine(boolean autoNewLine)

      Sets whether source layout should automatically insert line separators.

      Parameters:
        `autoNewLine` - `true` to insert new lines based on builder block layout

    - #### public void setBaseTemplateClass(Class<? extends BaseTemplate> baseTemplateClass)

      Set the template base class. You can use a distinct template class to provide more statically available data to your templates.

      Parameters:
        `baseTemplateClass` - a class extending BaseTemplate

    - #### public void setCacheTemplates(boolean cacheTemplates)

      If cache is enabled, then templates are compiled once for each source (URL or File). It is recommended to keep this flag to true unless you are in development mode and want automatic reloading of templates.

      Parameters:
        `cacheTemplates` - should templates be cached

    - #### public void setDeclarationEncoding(String declarationEncoding)

      Set the encoding used to write the declaration header. Note that it is the responsibility of the user to ensure that it matches the writer encoding.

      Parameters:
        `declarationEncoding` - encoding to be used in the declaration string

    - #### public void setExpandEmptyElements(boolean expandEmptyElements)

      Sets whether empty elements should be expanded into explicit opening and closing tags.

      Parameters:
        `expandEmptyElements` - `true` to render `<tag></tag>` instead of `<tag/>`

    - #### public void setLocale(Locale locale)

      Sets the locale used when resolving localized templates.

      Parameters:
        `locale` - locale to prefer when loading localized template resources

    - #### public void setNewLineString(String newLineString)

      Sets the line separator inserted by BaseTemplate.newLine.

      Parameters:
        `newLineString` - line separator to emit for explicit and automatic new lines

    - #### public void setUseDoubleQuotes(boolean useDoubleQuotes)

      Sets whether attributes should be rendered with double quotes.

      Parameters:
        `useDoubleQuotes` - `true` to use double quotes around attribute values