Class ServiceLoaderHelper


  • public class ServiceLoaderHelper
    extends Object
    Helper class for service loaders.
    • 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.