public final class ServiceLoader extends Object
This class loads services from files placed to the META-INF/services in classpath.
Modifier and Type | Method and Description |
---|---|
static <S> S |
loadService(Class<S> serviceClass) |
static <S> S |
loadService(Class<S> serviceClass,
Class<? extends S> defaultImplementation) |
static <S> Collection<Class<? extends S>> |
loadServiceClasses(Class<S> serviceClass)
Load service implementation classes. |
static <S> Collection<S> |
loadServices(Class<S> serviceClass)
Load and instantiate all service implementations. |
public static <S> Collection<S> loadServices(Class<S> serviceClass) throws ServiceException
Load and instantiate all service implementations.
S
- serviceClass
- ServiceException
public static <S> S loadService(Class<S> serviceClass, Class<? extends S> defaultImplementation)
public static <S> S loadService(Class<S> serviceClass)
public static <S> Collection<Class<? extends S>> loadServiceClasses(Class<S> serviceClass) throws ServiceException
Load service implementation classes.
S
- serviceClass
- ServiceException
Copyright © 2015 JBoss by Red Hat. All Rights Reserved.