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 leverages
StreamingMarkupBuilder
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(ClassLoader parentLoader, TemplateConfiguration tplConfig)
MarkupTemplateEngine(ClassLoader parentLoader, TemplateConfiguration tplConfig, TemplateResolver resolver)
MarkupTemplateEngine(ClassLoader parentLoader, File templateDirectory, TemplateConfiguration tplConfig)
Convenience constructor to build a template engine which searches for templates into a directory -
Method Summary
Methods inherited from class groovy.text.TemplateEngine
createTemplate, createTemplate, createTemplate, createTemplate
-
Constructor Details
-
MarkupTemplateEngine
public MarkupTemplateEngine() -
MarkupTemplateEngine
-
MarkupTemplateEngine
-
MarkupTemplateEngine
public MarkupTemplateEngine(ClassLoader parentLoader, TemplateConfiguration tplConfig, TemplateResolver resolver) -
MarkupTemplateEngine
public MarkupTemplateEngine(ClassLoader parentLoader, 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 Details
-
createTemplate
public Template createTemplate(Reader reader) throws CompilationFailedException, ClassNotFoundException, IOExceptionDescription copied from class:TemplateEngine
Creates a template by reading content from the Reader.- Specified by:
createTemplate
in classTemplateEngine
- Throws:
CompilationFailedException
ClassNotFoundException
IOException
-
createTemplate
public Template createTemplate(Reader reader, String sourceName) throws CompilationFailedException, ClassNotFoundException, IOException -
createTemplateByPath
public Template createTemplateByPath(String templatePath) throws CompilationFailedException, ClassNotFoundException, IOException -
createTypeCheckedModelTemplate
public Template createTypeCheckedModelTemplate(String source, Map<String,String> modelTypes) throws CompilationFailedException, ClassNotFoundException, IOException -
createTypeCheckedModelTemplate
public Template createTypeCheckedModelTemplate(String source, String sourceName, Map<String,String> modelTypes) throws CompilationFailedException, ClassNotFoundException, IOException -
createTypeCheckedModelTemplate
public Template createTypeCheckedModelTemplate(Reader reader, Map<String,String> modelTypes) throws CompilationFailedException, ClassNotFoundException, IOException -
createTypeCheckedModelTemplate
public Template createTypeCheckedModelTemplate(Reader reader, String sourceName, Map<String,String> modelTypes) throws CompilationFailedException, ClassNotFoundException, IOException -
createTypeCheckedModelTemplateByPath
public Template createTypeCheckedModelTemplateByPath(String templatePath, Map<String,String> modelTypes) throws CompilationFailedException, ClassNotFoundException, IOException -
createTemplate
public Template createTemplate(URL resource) throws CompilationFailedException, ClassNotFoundException, IOExceptionDescription copied from class:TemplateEngine
Creates a template from the content found at the URL using the default encoding. Please consider usingTemplateEngine.createTemplate(URL, Charset)
.- Overrides:
createTemplate
in classTemplateEngine
- Throws:
CompilationFailedException
ClassNotFoundException
IOException
-
createTypeCheckedModelTemplate
public Template createTypeCheckedModelTemplate(URL resource, Map<String,String> modelTypes) throws CompilationFailedException, ClassNotFoundException, IOException -
getTemplateLoader
-
getCompilerConfiguration
-
getTemplateConfiguration
-
resolveTemplate
- Throws:
IOException
-