Class TemplateCompilerFactory
- java.lang.Object
-
- org.rodnansol.core.generator.template.compiler.TemplateCompilerFactory
-
public class TemplateCompilerFactory extends Object
Factory class that uses theServiceLoaderclass to have dynamic implementations for theTemplateCompilerand make sure end users are able to customize it for their own taste.- Since:
- 0.1.2
- Author:
- nandorholozsnyak
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TemplateCompilergetDefaultCompiler()Returns the default provided instance which is theHandlebarsTemplateCompiler.static StringgetDefaultCompilerName()Returns the class name of the defualt compiler.static TemplateCompilergetInstance(String templateCompilerName)Returns aTemplateCompilerinstance by its class name.static TemplateCompilergetInstanceByClassName(String className)Instantiates the incoming class by its name.
-
-
-
Method Detail
-
getInstance
public static TemplateCompiler getInstance(String templateCompilerName)
Returns aTemplateCompilerinstance by its class name.- Parameters:
templateCompilerName- template compiler's class name.- Returns:
TemplateCompilerinstance.- Throws:
IllegalStateException- if the given template compiler name is not having any implementation.
-
getInstanceByClassName
public static TemplateCompiler getInstanceByClassName(String className)
Instantiates the incoming class by its name.- Parameters:
className- class to be created.- Returns:
- created class.
- Throws:
IllegalStateException- if the class can not be created.
-
getDefaultCompiler
public static TemplateCompiler getDefaultCompiler()
Returns the default provided instance which is theHandlebarsTemplateCompiler.- Returns:
- returns the singleton
HandlebarsTemplateCompilerinstance.
-
getDefaultCompilerName
public static String getDefaultCompilerName()
Returns the class name of the defualt compiler.
-
-