public abstract class ServiceProvider extends Object
All the methods in this class are safe for use by multiple concurrent threads.
Modifier | Constructor and Description |
---|---|
protected |
ServiceProvider()
Creates a new service provider.
|
Modifier and Type | Method and Description |
---|---|
static List<ServiceProvider> |
available()
Returns the list of available service providers.
|
static ServiceProvider |
current()
Returns the current
ServiceProvider . |
int |
getPriority()
This method allows to define a priority for a registered ServiceProvider instance.
|
abstract <Q extends Quantity<Q>> |
getQuantityFactory(Class<Q> quantity)
Return a factory for this
Quantity . |
abstract SystemOfUnitsService |
getSystemOfUnitsService()
Returns the service to obtain a
SystemOfUnits , or null if none. |
abstract UnitFormatService |
getUnitFormatService()
Returns the service to obtain a
UnitFormat , or null if none. |
static ServiceProvider |
setCurrent(ServiceProvider provider)
Replaces the current
ServiceProvider . |
protected ServiceProvider()
public int getPriority()
public abstract SystemOfUnitsService getSystemOfUnitsService()
SystemOfUnits
, or null
if none.SystemOfUnits
, or null
.public abstract UnitFormatService getUnitFormatService()
UnitFormat
, or null
if none.UnitFormat
, or null
.public abstract <Q extends Quantity<Q>> QuantityFactory<Q> getQuantityFactory(Class<Q> quantity)
Quantity
.quantity
- the quantityQuantityFactory
public static List<ServiceProvider> available()
public static ServiceProvider current()
ServiceProvider
. If necessary the ServiceProvider
will be lazily loaded.ServiceProvider
used.IllegalStateException
- if no ServiceProvider
has been found.public static ServiceProvider setCurrent(ServiceProvider provider)
ServiceProvider
.provider
- the new ServiceProvider
Copyright © 2014–2016 Jean-Marie Dautelle, Werner Keil, V2COM. All rights reserved.