Top Description Fields Constructors Methods
groovy.text.markup

public Class TemplateConfiguration

extends Object
Class Inheritance
Imports
java.util.Locale

Configuration options for the markup template engine.

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private String
private boolean
private Class<? extends BaseTemplate>
private boolean
private String
private boolean
private Locale
private String
private boolean

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public String
public Class<? extends BaseTemplate>
public String

Returns:

the encoding used in the declaration header
getDeclarationEncoding
()

public Locale
public String
public boolean

Returns:

true if variables in the model which are assignable to java.lang.CharSequence should be automatically escaped.
isAutoEscape
()

public boolean

Returns:

true if the template engine should handle indents automatically
isAutoIndent
()

public boolean
public boolean
public boolean

Returns:

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

public boolean

Returns:

true if attributes should use double quotes instead of single quotes
isUseDoubleQuotes
()

public void
setAutoEscape(final boolean
value if the autoEscape flag
autoEscape
)

Set to true if you want variables in the model which are assignable to java.lang.CharSequence to be escaped automatically in templates.

public void
setAutoIndent(final boolean
the auto-indent flag
autoIndent
)

Set this to true if you want the template engine to render indents automatically.

public void
setAutoIndentString(final String autoIndentString)

public void
setAutoNewLine(final boolean autoNewLine)

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

Set the template base class.

public void
setCacheTemplates(final boolean
should templates be cached
cacheTemplates
)

If cache is enabled, then templates are compiled once for each source (URL or File).

public void
setDeclarationEncoding(final String
encoding to be used in the declaration string
declarationEncoding
)

Set the encoding used to write the declaration header.

public void
setExpandEmptyElements(final boolean expandEmptyElements)

public void
setLocale(final Locale locale)

public void
setNewLineString(final String newLineString)

public void
setUseDoubleQuotes(final boolean useDoubleQuotes)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

autoEscapeback to summary
private boolean autoEscape
autoIndentback to summary
private boolean autoIndent
autoIndentStringback to summary
private String autoIndentString
autoNewLineback to summary
private boolean autoNewLine
baseTemplateClassback to summary
private Class<? extends BaseTemplate> baseTemplateClass
cacheTemplatesback to summary
private boolean cacheTemplates
declarationEncodingback to summary
private String declarationEncoding
expandEmptyElementsback to summary
private boolean expandEmptyElements
localeback to summary
private Locale locale
newLineStringback to summary
private String newLineString
useDoubleQuotesback to summary
private boolean useDoubleQuotes

Constructor Detail

TemplateConfigurationback to summary
public TemplateConfiguration()
TemplateConfigurationback to summary
public TemplateConfiguration(TemplateConfiguration that)

Method Detail

getAutoIndentStringback to summary
public String getAutoIndentString()
getBaseTemplateClassback to summary
public Class<? extends BaseTemplate> getBaseTemplateClass()
getDeclarationEncodingback to summary
public String getDeclarationEncoding()
Returns:String

the encoding used in the declaration header

getLocaleback to summary
public Locale getLocale()
getNewLineStringback to summary
public String getNewLineString()
isAutoEscapeback to summary
public boolean isAutoEscape()
Returns:boolean

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

isAutoIndentback to summary
public boolean isAutoIndent()
Returns:boolean

true if the template engine should handle indents automatically

isAutoNewLineback to summary
public boolean isAutoNewLine()
isCacheTemplatesback to summary
public boolean isCacheTemplates()
isExpandEmptyElementsback to summary
public boolean isExpandEmptyElements()
Returns:boolean

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

isUseDoubleQuotesback to summary
public boolean isUseDoubleQuotes()
Returns:boolean

true if attributes should use double quotes instead of single quotes

setAutoEscapeback to summary
public void setAutoEscape(final boolean autoEscape)

Set to true if you want variables in the model which are assignable to java.lang.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:boolean

value if the autoEscape flag

setAutoIndentback to summary
public void setAutoIndent(final 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 groovy.text.markup.DelegatingIndentWriter and indents are inserted after each call to newLine.

Parameters
autoIndent:boolean

the auto-indent flag

setAutoIndentStringback to summary
public void setAutoIndentString(final String autoIndentString)
setAutoNewLineback to summary
public void setAutoNewLine(final boolean autoNewLine)
setBaseTemplateClassback to summary
public void setBaseTemplateClass(final 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:Class<? extends BaseTemplate>

a class extending groovy.text.markup.BaseTemplate

setCacheTemplatesback to summary
public void setCacheTemplates(final 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:boolean

should templates be cached

setDeclarationEncodingback to summary
public void setDeclarationEncoding(final 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:String

encoding to be used in the declaration string

setExpandEmptyElementsback to summary
public void setExpandEmptyElements(final boolean expandEmptyElements)
setLocaleback to summary
public void setLocale(final Locale locale)
setNewLineStringback to summary
public void setNewLineString(final String newLineString)
setUseDoubleQuotesback to summary
public void setUseDoubleQuotes(final boolean useDoubleQuotes)