Package ej.service

Interface ServiceLoader

    • Method Detail

      • getService

        @Nullable
        <T> T getService​(Class<T> service)
        Gets the instance of the given service.

        If there is already an instance in cache, it is returned otherwise a new one is created.

        May return null if the service is not defined.

        Type Parameters:
        T - the service type.
        Parameters:
        service - the service.
        Returns:
        the instance of the given service.
        Throws:
        ServiceLoadingException - if an error occurs while instantiating the service instance.
        SecurityException - if a security manager exists and does not allow the caller to retrieve the given service instance.