com.aragost.javahg.internals
Class ServiceLoader
java.lang.Object
com.aragost.javahg.internals.ServiceLoader
public final class ServiceLoader
- extends Object
The ServiceLoader searches for Service implementations in META-INF/services.
This class emulates the behavior of ServiceLoader introduced in Java 1.6.
- Author:
- Sebastian Sdorra
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ServiceLoader
public ServiceLoader()
loadService
public static <S> S loadService(Class<S> serviceClass)
throws ServiceException
- This method is shorthand for
loadService(java.lang.ClassLoader, java.lang.Class)
with the context classloader.
- Parameters:
serviceClass
- classloader used to load the resource from META-INF/services
- Returns:
- service implementation or null
- Throws:
ServiceException
loadService
public static <S> S loadService(ClassLoader classLoader,
Class<S> serviceClass)
throws ServiceException
- Returns a implementation of the given service or null if no service could
be found.
- Parameters:
classLoader
- classloader used to load the resource from META-INF/servicesserviceClass
- service class to load
- Returns:
- service implementation or null
- Throws:
ServiceException
Copyright © 2011-2013 aragost Trifork ag. All Rights Reserved.