Class ServiceFactory


  • public class ServiceFactory
    extends Object
    Runtime instantiation of services.
    • Constructor Detail

      • ServiceFactory

        public ServiceFactory()
                       throws DependencyException
        Constructor loading service configuration from the default location.
        Throws:
        DependencyException - If there is an error locating or reading from the default configuration location.
      • ServiceFactory

        public ServiceFactory​(String path)
                       throws DependencyException
        Constructor loading service configuration from a given location.
        Parameters:
        path - Location to load service configuration from.
        Throws:
        DependencyException - If there is an error locating or reading from path.
    • Method Detail

      • getInstance

        public <T extends Service> T getInstance​(Class<T> type)
                                          throws DependencyException
        Retrieves an instance of a given service.
        Type Parameters:
        T - generic service type
        Parameters:
        type - Interface type of the service.
        Returns:
        A newly instantiated service.
        Throws:
        DependencyException - If there is an error instantiating the service instance requested.