public class ServiceFactory extends Object
ServiceFinder.@Service-annotation.| Modifier and Type | Method and Description |
|---|---|
static <T> T |
createService(Class<T> serviceClass)
Utility method to create a service instance.
This is the standard way to instantiate singletons. |
static <T> T |
createService(Class<T> serviceClass,
Class<? extends T> defaultClass)
Utility method to create a service instance with a default if not found.
|
static <T> Class<T> |
createServiceClass(Class<T> serviceClass)
Utility method to create a service instance.
This is the standard way to instantiate singletons. |
static ServiceFinder |
getServiceFinder()
Gets a service finder.
If the finder does not exist yet, it will be created. |
static ServiceFinder |
getServiceFinder(ClassLoader loader,
String servicePath)
Gets a service finder for a given classloader and service path.
If the finder does not exist yet, it will be created. |
static ServiceFinder |
getServiceFinder(String servicePath)
Gets a service finder for a given service path.
If the finder does not exist yet, it will be created. |
public static ServiceFinder getServiceFinder(ClassLoader loader, String servicePath)
loader - the classloaderservicePath - the service path prefixpublic static ServiceFinder getServiceFinder(String servicePath)
Thread.currentThread().getContextClassLoader().servicePath - the service path prefixpublic static ServiceFinder getServiceFinder()
Thread.currentThread().getContextClassLoader()
and the service path is "META_INF/services/".public static <T> Class<T> createServiceClass(Class<T> serviceClass)
T - the service typeserviceClass - the service classpublic static <T> T createService(Class<T> serviceClass)
T - the service typeserviceClass - the service classpublic static <T> T createService(Class<T> serviceClass, Class<? extends T> defaultClass)
T - the service typeserviceClass - the service classdefaultClass - the default class if no service foundCopyright © 2016 Krake Softwaretechnik. All rights reserved.