|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TemplateEngine
This class represents the central engine of the Pease Plate engine.
Usually just create exactly one instance of this class for all your rendering duties. It stores all global and reusable settings for template rendering and is thread safe. It contains a cache that stores compiled templates.
Method Summary | |
---|---|
void |
addClassLoader(java.lang.ClassLoader... classLoaders)
Adds the specified class loaders to the facotry. |
Template |
compile(char[] source)
Compiles the template defined by the source. |
Template |
compile(java.lang.String source)
Compiles the template defined by the source. |
Template |
compile(TemplateLocator locator)
Compiles the template defined by the specified locator. |
CacheService |
getCacheService()
Returns the cache service used to cache templates and messages |
java.util.Collection<java.lang.ClassLoader> |
getClassLoaders()
Returns all the class loaders in an unmodifiable collection. |
ConversionService |
getConversionService()
Returns the conversion service used to convert objects from one type to another |
java.lang.String |
getDefaultEncoding()
Returns the default encoding used when no encoding is specified somewhere where needed |
LineSeparator |
getDefaultLineSeparator()
Returns the default line separator |
java.util.Locale |
getDefaultLocale()
Returns the default locale used when no locale is specified somewhere where needed |
DesignatorService |
getDesignatorService()
Returns the designator service used to resolve and handle designators |
MacroService |
getMacroService()
Returns the macro service used to resolve and handle predefined macros |
ResolverService |
getResolverService()
Returns the resolver service used to resolve templates and messages |
TransformerService |
getTransformerService()
Returns the transformer service used to resolve and handle transformers |
void |
render(java.io.Writer writer,
java.lang.Object workingObject,
ResourceKey key)
Renders the template specified by the descriptor The workingObject is just any object or bean, that contains the data that should be integrated in the template. |
void |
render(java.io.Writer writer,
java.lang.Object workingObject,
java.lang.String name)
Renders the template with the specified name to the specified writer. |
void |
render(java.io.Writer writer,
java.lang.Object workingObject,
java.lang.String name,
java.util.Locale locale)
Renders the template with the specified name to the specified writer. |
void |
render(java.io.Writer writer,
java.lang.Object workingObject,
java.lang.String name,
java.util.Locale locale,
java.lang.String encoding)
Renders the template with the specified name to the specified writer. |
void |
render(java.io.Writer writer,
java.lang.Object workingObject,
java.lang.String name,
java.lang.String encoding)
Renders the template with the specified name to the specified writer. |
void |
setDefaultEncoding(java.lang.String defaultEncoding)
Sets the default encoding used when no encoding is specified somewhere where needed |
void |
setDefaultLineSeparator(LineSeparator defaultLineSeparator)
Sets the default line separator |
void |
setDefaultLocale(java.util.Locale defaultLocale)
Sets the default locale used when no locale is specified somewhere where needed |
Method Detail |
---|
void addClassLoader(java.lang.ClassLoader... classLoaders)
classLoaders
- the class loadersjava.util.Collection<java.lang.ClassLoader> getClassLoaders()
CacheService getCacheService()
ResolverService getResolverService()
DesignatorService getDesignatorService()
TransformerService getTransformerService()
MacroService getMacroService()
ConversionService getConversionService()
java.util.Locale getDefaultLocale()
void setDefaultLocale(java.util.Locale defaultLocale)
defaultLocale
- the default localejava.lang.String getDefaultEncoding()
void setDefaultEncoding(java.lang.String defaultEncoding)
defaultEncoding
- the default encodingLineSeparator getDefaultLineSeparator()
void setDefaultLineSeparator(LineSeparator defaultLineSeparator)
defaultLineSeparator
- the default line separatorTemplate compile(TemplateLocator locator) throws TemplateException
locator
- the locator
TemplateException
- on occasionTemplate compile(java.lang.String source) throws TemplateException
InMemoryTemplateLocator
,
which stores the source in memory.
source
- the source
TemplateException
Template compile(char[] source) throws TemplateException
InMemoryTemplateLocator
,
which stores the source in memory.
source
- the source
TemplateException
void render(java.io.Writer writer, java.lang.Object workingObject, java.lang.String name) throws TemplateException, java.io.IOException
Resolver
.
writer
- the writerworkingObject
- the working objectname
- the name of the template
TemplateException
- if anything goes wrong
java.io.IOException
- if it cannot write to the writervoid render(java.io.Writer writer, java.lang.Object workingObject, java.lang.String name, java.util.Locale locale) throws TemplateException, java.io.IOException
Resolver
.
writer
- the writerworkingObject
- the working objectname
- the name of the templatelocale
- the locale; uses the default locale if null
TemplateException
- if anything goes wrong
java.io.IOException
- if it cannot write to the writervoid render(java.io.Writer writer, java.lang.Object workingObject, java.lang.String name, java.lang.String encoding) throws TemplateException, java.io.IOException
Resolver
.
writer
- the writerworkingObject
- the working objectname
- the name of the templateencoding
- the encoding; uses the default encoding if null
TemplateException
- if anything goes wrong
java.io.IOException
- if it cannot write to the writervoid render(java.io.Writer writer, java.lang.Object workingObject, java.lang.String name, java.util.Locale locale, java.lang.String encoding) throws TemplateException, java.io.IOException
Resolver
.
writer
- the writerworkingObject
- the working objectname
- the name of the templatelocale
- the locale; uses the default locale if nullencoding
- the encoding; uses the default encoding if null
TemplateException
- if anything goes wrong
java.io.IOException
- if it cannot write to the writervoid render(java.io.Writer writer, java.lang.Object workingObject, ResourceKey key) throws TemplateException, java.io.IOException
Resolver
.
writer
- the writerworkingObject
- the working objectkey
- the key
TemplateException
- if anything goes wrong
java.io.IOException
- if it cannot write to the writer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |