public class MarkupTemplateEngine
extends TemplateEngine
A template engine which leverages StreamingMarkupBuilder to generate XML/XHTML.
| Modifiers | Name | Description |
|---|---|---|
static class |
MarkupTemplateEngine.CachingTemplateResolver |
A template resolver which avoids calling ClassLoader.getResource if a template path already has been queried before. |
static class |
MarkupTemplateEngine.DefaultTemplateResolver |
Default resolver that loads templates from the configured template class loader and applies locale fallback rules. |
static class |
MarkupTemplateEngine.TemplateResource |
Describes a template resource name split into base name, optional locale suffix, and extension. |
| Constructor and description |
|---|
MarkupTemplateEngine()Creates an engine with the default TemplateConfiguration. |
MarkupTemplateEngine(TemplateConfiguration config)Creates an engine with the supplied template configuration. |
MarkupTemplateEngine(ClassLoader parentLoader, TemplateConfiguration config)Creates an engine with the supplied parent loader and template configuration. |
MarkupTemplateEngine(ClassLoader parentLoader, TemplateConfiguration config, TemplateResolver resolver)Creates an engine with full control over the class loader, configuration, and resolver strategy. |
MarkupTemplateEngine(ClassLoader parentLoader, File templateDirectory, TemplateConfiguration tplConfig)Convenience constructor to build a template engine which searches for templates into a directory |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public Template |
createTemplate(Reader reader)Compiles a template from a reader. |
|
public Template |
createTemplate(Reader reader, String sourceName)Compiles a template from a reader using an explicit source name. |
|
public Template |
createTemplate(URL resource)Compiles a template from a resolved resource URL. |
|
public Template |
createTemplateByPath(String templatePath)Resolves and compiles a template by path. |
|
public Template |
createTypeCheckedModelTemplate(String source, Map<String, String> modelTypes)Compiles inline template source with explicit model type hints. |
|
public Template |
createTypeCheckedModelTemplate(String source, String sourceName, Map<String, String> modelTypes)Compiles inline template source with explicit model type hints and a source name. |
|
public Template |
createTypeCheckedModelTemplate(Reader reader, Map<String, String> modelTypes)Compiles template source from a reader with explicit model type hints. |
|
public Template |
createTypeCheckedModelTemplate(Reader reader, String sourceName, Map<String, String> modelTypes)Compiles template source from a reader with explicit model type hints and a source name. |
|
public Template |
createTypeCheckedModelTemplate(URL resource, Map<String, String> modelTypes)Compiles a template from a resolved resource URL with explicit model type hints. |
|
public Template |
createTypeCheckedModelTemplateByPath(String templatePath, Map<String, String> modelTypes)Resolves and compiles a template by path with explicit model type hints. |
|
public CompilerConfiguration |
getCompilerConfiguration()Returns the Groovy compiler configuration used for generated template classes. |
|
public TemplateConfiguration |
getTemplateConfiguration()Returns the rendering configuration used by this engine. |
|
public GroovyClassLoader |
getTemplateLoader()Returns the class loader used to compile generated template classes. |
|
public URL |
resolveTemplate(String templatePath)Resolves a logical template path into a concrete resource URL. |
| Methods inherited from class | Name |
|---|---|
class TemplateEngine |
createTemplate, createTemplate, createTemplate, createTemplate, createTemplate, createTemplate |
Creates an engine with the default TemplateConfiguration.
Creates an engine with the supplied template configuration.
config - template configuration to apply while compiling and rendering templatesCreates an engine with the supplied parent loader and template configuration.
parentLoader - class loader used to compile generated template classesconfig - template configuration to apply while compiling and rendering templatesCreates an engine with full control over the class loader, configuration, and resolver strategy.
parentLoader - class loader used to compile generated template classesconfig - template configuration to apply while compiling and rendering templatesresolver - template resolver to use, or null for the default resolverConvenience constructor to build a template engine which searches for templates into a directory
templateDirectory - directory where to find templatestplConfig - template engine configurationCompiles a template from a reader.
reader - template sourceCompiles a template from a reader using an explicit source name.
reader - template sourcesourceName - source name used for diagnostics and generated classesCompiles a template from a resolved resource URL.
resource - template resourceResolves and compiles a template by path.
templatePath - logical template path understood by the configured resolverCompiles inline template source with explicit model type hints.
source - template sourcemodelTypes - model variable type hints keyed by variable nameCompiles inline template source with explicit model type hints and a source name.
source - template sourcesourceName - source name used for diagnostics and generated classesmodelTypes - model variable type hints keyed by variable nameCompiles template source from a reader with explicit model type hints.
reader - template sourcemodelTypes - model variable type hints keyed by variable nameCompiles template source from a reader with explicit model type hints and a source name.
reader - template sourcesourceName - source name used for diagnostics and generated classesmodelTypes - model variable type hints keyed by variable nameCompiles a template from a resolved resource URL with explicit model type hints.
resource - template resourcemodelTypes - model variable type hints keyed by variable nameResolves and compiles a template by path with explicit model type hints.
templatePath - logical template path understood by the configured resolvermodelTypes - model variable type hints keyed by variable nameReturns the Groovy compiler configuration used for generated template classes.
Returns the rendering configuration used by this engine.
Returns the class loader used to compile generated template classes.
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.