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.
| Modifier and Type | Method and Description |
|---|---|
| public default CurrencyConversion | Returns: the corresponding conversion, not null.the conversionQuery)javax.money.convert.ConversionQuery determining the type of conversion
required, not null.Access an instance of |
| public default CurrencyConversion | Returns: the corresponding conversion, not null.the terminating/target currency unit, not null. termCurrency, String... the providers)javax.money.convert.ConversionQuery provider names defines a corresponding
provider chain that must be encapsulated by the resulting default-package.money.convert.CurrencyConversion. By default the default
provider chain as defined by #getDefaultCurrencyProviderChain will be used.Access an instance of |
| public List | Returns: the default provider chain, notnull and not empty.Get the default provider chain used. |
| public ExchangeRateProvider | getExchangeRateProvider(ConversionQuery
the conversionQuery)javax.money.convert.ConversionQuery determining the type of conversion
required, not null.Access an instance of |
| public default ExchangeRateProvider | getExchangeRateProvider(String...
the providers)javax.money.convert.ConversionQuery provider names defines a corresponding
provider chain that must be
encapsulated by the resulting javax.money.convert.ExchangeRateProvider. By default
the default
provider changes as defined in #getDefaultCurrencyProviderChain will be used.Access a compound instance of an |
| public default List | Returns: the list of providers, in the same order as requested.the provider names of the providers to be accessed providers)Access the current registered |
| public Collection | Returns: all currently registered provider namesGet all currently registered provider names. |
| public default boolean | Returns: true, if such a conversion is supported, meaning an according
CurrencyConversion can be
accessed.the conversionQuery)javax.money.convert.ConversionQuery determining the type of conversion
required, not null.Allows to quickly check, if a |
| public default boolean | Returns: true, if such a conversion is supported, meaning an according
CurrencyConversion can be
accessed.the terminating/target currency unit, not null. termCurrency, String... the provider names defines a corresponding
provider chain that must be encapsulated by the resulting default-package providers).money.convert.CurrencyConversion. By default the provider
chain as defined by #getDefaultCurrencyProviderChain will be used.Allows to quickly check, if a |
| public default boolean | Returns: true, if such a conversion is supported, meaning an according
ExchangeRateProvider can be
accessed.the conversionQuery)javax.money.convert.ConversionQuery determining the type of conversion
required, not null.Allows to quickly check, if a |
| getConversion | back to summary |
|---|---|
| public default CurrencyConversion getConversion(ConversionQuery conversionQuery) Access an instance of
| |
| getConversion | back to summary |
|---|---|
| public default CurrencyConversion getConversion(CurrencyUnit termCurrency, String... providers) Access an instance of
| |
| getDefaultProviderChain | back to summary |
|---|---|
| public List Get the default provider chain used. The ordering of the items is the access order/precedence of the providers. | |
| getExchangeRateProvider | back to summary |
|---|---|
| public ExchangeRateProvider getExchangeRateProvider(ConversionQuery conversionQuery) Access an instance of
| |
| getExchangeRateProvider | back to summary |
|---|---|
| public default ExchangeRateProvider getExchangeRateProvider(String... providers) Access a compound instance of an
| |
| getExchangeRateProviders | back to summary |
|---|---|
| public default List Access the current registered
| |
| getProviderNames | back to summary |
|---|---|
| public Collection Get all currently registered provider names.
| |
| isConversionAvailable | back to summary |
|---|---|
| public default boolean isConversionAvailable(ConversionQuery conversionQuery) Allows to quickly check, if a
| |
| isConversionAvailable | back to summary |
|---|---|
| public default boolean isConversionAvailable(CurrencyUnit termCurrency, String... providers) Allows to quickly check, if a
| |
| isExchangeRateProviderAvailable | back to summary |
|---|---|
| public default boolean isExchangeRateProviderAvailable(ConversionQuery conversionQuery) Allows to quickly check, if a
| |