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(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
-
-
-
-
Constructor Detail
-
MarkupTemplateEngine
public MarkupTemplateEngine()
-
MarkupTemplateEngine
public MarkupTemplateEngine(TemplateConfiguration tplConfig)
-
MarkupTemplateEngine
public MarkupTemplateEngine(ClassLoader parentLoader, TemplateConfiguration tplConfig)
-
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 Detail
-
createTemplate
public Template createTemplate(Reader reader) throws CompilationFailedException, ClassNotFoundException, IOException
- 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
- Overrides:
createTemplate
in classTemplateEngine
- Throws:
CompilationFailedException
ClassNotFoundException
IOException
-
createTypeCheckedModelTemplate
public Template createTypeCheckedModelTemplate(URL resource, Map<String,String> modelTypes) throws CompilationFailedException, ClassNotFoundException, IOException
-
getTemplateLoader
public GroovyClassLoader getTemplateLoader()
-
getCompilerConfiguration
public CompilerConfiguration getCompilerConfiguration()
-
getTemplateConfiguration
public TemplateConfiguration getTemplateConfiguration()
-
resolveTemplate
public URL resolveTemplate(String templatePath) throws IOException
- Throws:
IOException
-
-