Package groovy.text.markup
Class MarkupTemplateEngine
java.lang.Object
groovy.text.TemplateEngine
groovy.text.markup.MarkupTemplateEngine
A template engine which leverages
StreamingMarkupBuilder
to generate XML/XHTML.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A template resolver which avoids callingClassLoader.getResource(String)
if a template path already has been queried before.static class
static class
-
Constructor Summary
ConstructorDescriptionMarkupTemplateEngine
(ClassLoader parentLoader, TemplateConfiguration config) MarkupTemplateEngine
(ClassLoader parentLoader, TemplateConfiguration config, 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
Modifier and TypeMethodDescriptioncreateTemplate
(Reader reader) Creates a template by reading content from the Reader.createTemplate
(Reader reader, String sourceName) createTemplate
(URL resource) Creates a template from the content found at the URL using the default encoding.createTemplateByPath
(String templatePath) createTypeCheckedModelTemplate
(Reader reader, Map<String, String> modelTypes) createTypeCheckedModelTemplate
(String source, Map<String, String> modelTypes) createTypeCheckedModelTemplate
(URL resource, Map<String, String> modelTypes) createTypeCheckedModelTemplateByPath
(String templatePath, Map<String, String> modelTypes) resolveTemplate
(String templatePath) Methods inherited from class groovy.text.TemplateEngine
createTemplate, createTemplate, createTemplate, createTemplate
-
Constructor Details
-
MarkupTemplateEngine
public MarkupTemplateEngine() -
MarkupTemplateEngine
-
MarkupTemplateEngine
-
MarkupTemplateEngine
public MarkupTemplateEngine(ClassLoader parentLoader, TemplateConfiguration config, 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, IOException Description 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, IOException Description 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
-