- java.lang.Object
-
- javax.money.spi.DefaultServiceProvider
-
- All Implemented Interfaces:
ServiceProvider
class DefaultServiceProvider extends java.lang.Object implements ServiceProvider
This class implements the (default)ServiceProviderinterface and hereby uses the JDKServiceLoaderto load the services required.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.ConcurrentHashMap<java.lang.Class<?>,java.util.List<java.lang.Object>>servicesLoadedList of services loaded, per class.
-
Constructor Summary
Constructors Constructor Description DefaultServiceProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetPriority()This method allows to define a priority for a registered ServiceProvider instance.<T> java.util.List<T>getServices(java.lang.Class<T> serviceType)Loads and registers services.private <T> java.util.List<T>loadServices(java.lang.Class<T> serviceType)Loads and registers services.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.money.spi.ServiceProvider
getService
-
-
-
-
Method Detail
-
getPriority
public int getPriority()
Description copied from interface:ServiceProviderThis method allows to define a priority for a registered ServiceProvider instance. When multiple providers are registered in the system the provider with the highest priority value is taken.- Specified by:
getPriorityin interfaceServiceProvider- Returns:
- the provider's priority (default is 0).
-
getServices
public <T> java.util.List<T> getServices(java.lang.Class<T> serviceType)
Loads and registers services.- Specified by:
getServicesin interfaceServiceProvider- Type Parameters:
T- the concrete type.- Parameters:
serviceType- The service type.- Returns:
- the items found, never
null.
-
loadServices
private <T> java.util.List<T> loadServices(java.lang.Class<T> serviceType)
Loads and registers services.- Type Parameters:
T- the concrete type.- Parameters:
serviceType- The service type.- Returns:
- the items found, never
null.
-
-