Module java.money

Interface MonetaryConversionsSingletonSpi


public interface MonetaryConversionsSingletonSpi
SPI (conversion) that implements the functionality provided by the MonetaryConversions singleton accessor. It should be registered as a service using the JDK ServiceLoader. Hereby only one instance can be registered at a time.

This interface is designed to support also contextual behaviour, e.g. in Java EE containers each application may provide its own ExchangeRateProvider instances, e.g. by registering them as CDI beans. An EE container can register an according MonetaryConversionsSingletonSpi that manages the different application contexts transparently. In a SE environment this class is expected to behave like an ordinary singleton, loading its SPIs from the ServiceLoader.

Instances of this class must be thread safe. It is not a requirement that they are serializable.

Only one instance can be registered using the ServiceLoader. When registering multiple instances the MonetaryConversions accessor will not work.

Author:
Anatole Tresch, Werner Keil