Package groovy.text.markup
Class MarkupTemplateEngine
- java.lang.Object
-
- groovy.text.TemplateEngine
-
- groovy.text.markup.MarkupTemplateEngine
-
public class MarkupTemplateEngine extends TemplateEngine
A template engine which leveragesStreamingMarkupBuilder
to generate XML/XHTML.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MarkupTemplateEngine.CachingTemplateResolver
A template resolver which avoids callingClassLoader.getResource(String)
if a template path already has been queried before.static class
MarkupTemplateEngine.DefaultTemplateResolver
static class
MarkupTemplateEngine.TemplateResource
-
Constructor Summary
Constructors Constructor Description MarkupTemplateEngine()
MarkupTemplateEngine(TemplateConfiguration tplConfig)
MarkupTemplateEngine(java.lang.ClassLoader parentLoader, TemplateConfiguration tplConfig)
MarkupTemplateEngine(java.lang.ClassLoader parentLoader, TemplateConfiguration tplConfig, TemplateResolver resolver)
MarkupTemplateEngine(java.lang.ClassLoader parentLoader, java.io.File templateDirectory, TemplateConfiguration tplConfig)
Convenience constructor to build a template engine which searches for templates into a directory
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Template
createTemplate(java.io.Reader reader)
Template
createTemplate(java.io.Reader reader, java.lang.String sourceName)
Template
createTemplate(java.net.URL resource)
Template
createTemplateByPath(java.lang.String templatePath)
Template
createTypeCheckedModelTemplate(java.io.Reader reader, java.lang.String sourceName, java.util.Map<java.lang.String,java.lang.String> modelTypes)
Template
createTypeCheckedModelTemplate(java.io.Reader reader, java.util.Map<java.lang.String,java.lang.String> modelTypes)
Template
createTypeCheckedModelTemplate(java.lang.String source, java.lang.String sourceName, java.util.Map<java.lang.String,java.lang.String> modelTypes)
Template
createTypeCheckedModelTemplate(java.lang.String source, java.util.Map<java.lang.String,java.lang.String> modelTypes)
Template
createTypeCheckedModelTemplate(java.net.URL resource, java.util.Map<java.lang.String,java.lang.String> modelTypes)
Template
createTypeCheckedModelTemplateByPath(java.lang.String templatePath, java.util.Map<java.lang.String,java.lang.String> modelTypes)
CompilerConfiguration
getCompilerConfiguration()
TemplateConfiguration
getTemplateConfiguration()
GroovyClassLoader
getTemplateLoader()
java.net.URL
resolveTemplate(java.lang.String templatePath)
-
Methods inherited from class groovy.text.TemplateEngine
createTemplate, createTemplate
-
-
-
-
Constructor Detail
-
MarkupTemplateEngine
public MarkupTemplateEngine()
-
MarkupTemplateEngine
public MarkupTemplateEngine(TemplateConfiguration tplConfig)
-
MarkupTemplateEngine
public MarkupTemplateEngine(java.lang.ClassLoader parentLoader, TemplateConfiguration tplConfig)
-
MarkupTemplateEngine
public MarkupTemplateEngine(java.lang.ClassLoader parentLoader, TemplateConfiguration tplConfig, TemplateResolver resolver)
-
MarkupTemplateEngine
public MarkupTemplateEngine(java.lang.ClassLoader parentLoader, java.io.File templateDirectory, TemplateConfiguration tplConfig)
Convenience constructor to build a template engine which searches for templates into a directory- Parameters:
templateDirectory
- directory where to find templatestplConfig
- template engine configuration
-
-
Method Detail
-
createTemplate
public Template createTemplate(java.io.Reader reader) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOException
- Specified by:
createTemplate
in classTemplateEngine
- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
createTemplate
public Template createTemplate(java.io.Reader reader, java.lang.String sourceName) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOException
- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
createTemplateByPath
public Template createTemplateByPath(java.lang.String templatePath) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOException
- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
createTypeCheckedModelTemplate
public Template createTypeCheckedModelTemplate(java.lang.String source, java.util.Map<java.lang.String,java.lang.String> modelTypes) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOException
- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
createTypeCheckedModelTemplate
public Template createTypeCheckedModelTemplate(java.lang.String source, java.lang.String sourceName, java.util.Map<java.lang.String,java.lang.String> modelTypes) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOException
- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
createTypeCheckedModelTemplate
public Template createTypeCheckedModelTemplate(java.io.Reader reader, java.util.Map<java.lang.String,java.lang.String> modelTypes) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOException
- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
createTypeCheckedModelTemplate
public Template createTypeCheckedModelTemplate(java.io.Reader reader, java.lang.String sourceName, java.util.Map<java.lang.String,java.lang.String> modelTypes) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOException
- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
createTypeCheckedModelTemplateByPath
public Template createTypeCheckedModelTemplateByPath(java.lang.String templatePath, java.util.Map<java.lang.String,java.lang.String> modelTypes) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOException
- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
createTemplate
public Template createTemplate(java.net.URL resource) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOException
- Overrides:
createTemplate
in classTemplateEngine
- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
createTypeCheckedModelTemplate
public Template createTypeCheckedModelTemplate(java.net.URL resource, java.util.Map<java.lang.String,java.lang.String> modelTypes) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOException
- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
getTemplateLoader
public GroovyClassLoader getTemplateLoader()
-
getCompilerConfiguration
public CompilerConfiguration getCompilerConfiguration()
-
getTemplateConfiguration
public TemplateConfiguration getTemplateConfiguration()
-
resolveTemplate
public java.net.URL resolveTemplate(java.lang.String templatePath) throws java.io.IOException
- Throws:
java.io.IOException
-
-