@OpenApiAll
public final class TemplateEngineFactory
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
copy(ITemplateEngine dest,
ITemplateEngine source)
Copies all properties and context from source engine to destination engine.
|
void |
copy(ITemplateEngine dest,
ITemplateEngine source,
boolean copyRuntimeInstance,
boolean copyFormatterRuntimeInstance)
Copies all properties and context from source engine to destination engine.
|
ITemplateEngine |
createTemplateEngine(java.lang.Class<? extends ITemplateEngine> clazz)
Create a new instance of template engine associated with given class.
|
ITemplateEngine |
createTemplateEngine(java.lang.String type)
Create a new instance of template engine associated with given type.
|
java.lang.String |
getDefaultTemplateEngineClassName(java.lang.String engineName)
Return default template engine class name.
|
static TemplateEngineFactory |
getInstance()
Return instance of this class.
|
java.lang.Class<? extends ITemplateEngine> |
getRegisterTemplateEngine(java.lang.String extension)
Return a registered template engine class.
|
java.lang.String[] |
getTemplateAliasNames()
Return an array of the alias names of default template engine.
|
ITemplateEngine |
getTemplateEngine(java.lang.Class<? extends ITemplateEngine> clazz)
Return template engine associated with given class or create a new instance if it doesn't created.
|
ITemplateEngine |
getTemplateEngine(java.lang.String type)
Return template engine associated with given type or create a new instance if it doesn't created.
|
java.lang.Class<? extends ITemplateEngine> |
getTemplateEngineClass(java.lang.String type)
Return class of template engine associated with given type.
|
void |
registerTemplateEngine(java.lang.String extension,
java.lang.Class<? extends ITemplateEngine> templateEngineClass)
Registers the given class name with the
TemplateEngineFactory . |
void |
unregisterTemplateEngine(java.lang.String extension)
Unregister the given file extension.
|
public static TemplateEngineFactory getInstance()
public java.lang.String getDefaultTemplateEngineClassName(java.lang.String engineName)
engineName
- name.public java.lang.String[] getTemplateAliasNames()
String[] aliasNames = TemplateEngineFactory.getInstance().getTemplateAliasNames();
public void registerTemplateEngine(java.lang.String extension, java.lang.Class<? extends ITemplateEngine> templateEngineClass)
TemplateEngineFactory
. A newly-loaded engine class should
call the method registerTemplateEngine to make itself known to the TemplateEngineFactory.extension
- template file extensiontemplateEngineClass
- the new ITemplateEngine
that is to be registered with the
TemplateEngineFactory
public void unregisterTemplateEngine(java.lang.String extension)
extension
- file extension.public java.lang.Class<? extends ITemplateEngine> getRegisterTemplateEngine(java.lang.String extension)
extension
- template file extensionITemplateEngine
public ITemplateEngine getTemplateEngine(java.lang.Class<? extends ITemplateEngine> clazz) throws InitializationEngineException
clazz
- associated class for template engine.InitializationEngineException
- error while creating template engine.public ITemplateEngine getTemplateEngine(java.lang.String type) throws InitializationEngineException
TextEngine
will be return
as default engine.type
- engine type.InitializationEngineException
- error while creating template engine.public java.lang.Class<? extends ITemplateEngine> getTemplateEngineClass(java.lang.String type)
TextEngine
will be return as default engine.type
- engine type.public ITemplateEngine createTemplateEngine(java.lang.String type) throws InitializationEngineException
TextEngine
will be return as default engine.
This method always return new instance.
type
- engine type.InitializationEngineException
- error while creating template engine.public ITemplateEngine createTemplateEngine(java.lang.Class<? extends ITemplateEngine> clazz) throws InitializationEngineException
This method always return new instance.
clazz
- engine Class.InitializationEngineException
- error while creating template engine.public void copy(ITemplateEngine dest, ITemplateEngine source)
This method will perform shallow copy of context. The reference to context of new engine will not remain the same as source engine. In order to copy, all object inside context requires implement clone() method.
dest
- the destination engine.source
- source engine.public void copy(ITemplateEngine dest, ITemplateEngine source, boolean copyRuntimeInstance, boolean copyFormatterRuntimeInstance)
This method will perform shallow copy of context. The reference to context of new engine will not remain the same as source engine. In order to copy, all object inside context requires implement clone() method.
dest
- the destination engine.source
- source engine.copyRuntimeInstance
- true to copy RuntimeInstance of source to destination engine if both are instance of IRuntimeInstanceVelocityEnginecopyFormatterRuntimeInstance
- true to copy Formatter of source to destination engine if both are instance of DefaultTemplateEngineCopyright © 2010 - No Magic Asia