- All Known Implementing Classes:
DefaultMonetaryCurrenciesSingletonSpi
public interface MonetaryCurrenciesSingletonSpi
Factory singleton backing interface for
Monetary that provides access to
different registered CurrencyProviderSpi instances.
Implementations of this interface must be thread safe.
- Version:
- 0.8
-
Method Summary
Modifier and TypeMethodDescriptiondefault Set<CurrencyUnit> getCurrencies(String... providers) Provide access to all currently known currencies.default Set<CurrencyUnit> getCurrencies(Locale locale, String... providers) Provide access to all currently known currencies.getCurrencies(CurrencyQuery query) Access all currencies matching the given query.default CurrencyUnitgetCurrency(String currencyCode, String... providers) Access a new instance based on the currency code.default CurrencyUnitgetCurrency(Locale country, String... providers) Access a new instance based on the currency code.default CurrencyUnitgetCurrency(CurrencyQuery query) Access a single currency by query.Access a list of the currently registered default providers.Access a list of the currently registered providers.default booleanisCurrencyAvailable(String code, String... providers) Allows to check if aCurrencyUnitinstance is defined, i.e.default booleanisCurrencyAvailable(Locale locale, String... providers) Allows to check if aCurrencyUnitinstance is defined, i.e.
-
Method Details
-
getDefaultProviderChain
Access a list of the currently registered default providers. The default providers are used, when no provider names are passed by the caller.- Returns:
- the currencies returned by the given provider chain. If not provider names are provided
the default provider chain configured in
javamoney.propertiesis used. - See Also:
-
getProviderNames
Access a list of the currently registered providers. The names can be used to access subsets of the overall currency range by callinggetCurrencies(String...).- Returns:
- the currencies returned by the given provider chain. If not provider names are provided
the default provider chain configured in
javamoney.propertiesis used.
-
getCurrencies
Access all currencies matching the given query.- Parameters:
query- The currency query, not null.- Returns:
- a set of all currencies found, never null.
-
getCurrency
Access a new instance based on the currency code. Currencies are available as provided byCurrencyProviderSpiinstances registered with theBootstrap.- Parameters:
currencyCode- the ISO currency code, notnull.providers- the (optional) specification of providers to consider. If not set (empty) the providers as defined by #getDefaultCurrencyProviderChain() should be used.- Returns:
- the corresponding
CurrencyUnitinstance. - Throws:
UnknownCurrencyException- if no such currency exists.
-
getCurrency
Access a new instance based on the currency code. Currencies are available as provided byCurrencyProviderSpiinstances registered with theBootstrap.- Parameters:
country- the ISO currency's country, notnull.providers- the (optional) specification of providers to consider. If not set (empty) the providers as defined by #getDefaultCurrencyProviderChain() should be used.- Returns:
- the corresponding
CurrencyUnitinstance. - Throws:
UnknownCurrencyException- if no such currency exists.
-
getCurrencies
Provide access to all currently known currencies.- Parameters:
locale- the targetLocale, typically representing an ISO country, notnull.providers- the (optional) specification of providers to consider. If not set (empty) the providers as defined by #getDefaultCurrencyProviderChain() should be used.- Returns:
- a collection of all known currencies, never null.
-
isCurrencyAvailable
Allows to check if aCurrencyUnitinstance is defined, i.e. accessible fromgetCurrency(String, String...).- Parameters:
code- the currency code, notnull.providers- the (optional) specification of providers to consider. If not set (empty) the providers as defined by #getDefaultCurrencyProviderChain() should be used.- Returns:
trueifgetCurrency(String, String...)would return a result for the given code.
-
isCurrencyAvailable
Allows to check if aCurrencyUnitinstance is defined, i.e. accessible fromgetCurrency(String, String...).- Parameters:
locale- the targetLocale, notnull.providers- the (optional) specification of providers to consider. If not set (empty) the providers as defined by #getDefaultCurrencyProviderChain() should be used.- Returns:
trueifgetCurrencies(java.util.Locale, String...)would return a non empty result for the given code.
-
getCurrencies
Provide access to all currently known currencies.- Parameters:
providers- the (optional) specification of providers to consider. If not set (empty) the providers as defined by #getDefaultCurrencyProviderChain() should be used.- Returns:
- a collection of all known currencies, never null.
-
getCurrency
Access a single currency by query.- Parameters:
query- The currency query, not null.- Returns:
- the
CurrencyUnitfound, never null. - Throws:
MonetaryException- if multiple currencies match the query.
-