Package ej.service.loader
Class ServiceLoaderHelper
- java.lang.Object
-
- ej.service.loader.ServiceLoaderHelper
-
public class ServiceLoaderHelper extends Object
Helper class for service loaders.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> TcreateClassInstance(Class<T> parent, Class<? extends T> clazz)Gets an instance of a class.static <T> TcreateClassInstance(Class<T> parent, String className)Gets an instance of a class, based on its name.
-
-
-
Method Detail
-
createClassInstance
public static <T> T createClassInstance(Class<T> parent, String className) throws ServiceLoadingException
Gets an instance of a class, based on its name.- Type Parameters:
T- the class type.- Parameters:
parent- the parent class.className- the name of the class to instantiate.- Returns:
- an instance of the given class.
- Throws:
ServiceLoadingException- if an error occurs while instantiating the service implementation.
-
createClassInstance
public static <T> T createClassInstance(Class<T> parent, Class<? extends T> clazz) throws ServiceLoadingException
Gets an instance of a class.- Type Parameters:
T- the class type.- Parameters:
parent- the parent class.clazz- the class to instantiate.- Returns:
- an instance of the given class.
- Throws:
ServiceLoadingException- if an error occurs while instantiating the service implementation.
-
-