Top Description Fields Constructors Methods
org.javamoney.moneta.spi

public Class ConfigurableCurrencyUnitProvider

extends Object
implements CurrencyProviderSpi
Class Inheritance
All Implemented Interfaces
javax.money.spi.CurrencyProviderSpi
Imports
javax.money.CurrencyQuery, .CurrencyUnit, javax.money.spi.CurrencyProviderSpi, java.time.LocalDate, .LocalDateTime, java.util.*, java.util.concurrent.ConcurrentHashMap, java.util.regex.Pattern

This class provides a programmatic singleton for globally registering new java.util.Currency into the javax.money.Monetary singleton either by currency code, locale, or both.

Field Summary

Modifier and TypeField and Description
private static final Map<String, CurrencyUnit>
CURRENCY_UNITS

The currency units, identified by currency code.

private static final Map<Locale, CurrencyUnit>
CURRENCY_UNITS_BY_LOCALE

The currency units identified by Locale.

private static final Map<Integer, CurrencyUnit>
CURRENCY_UNITS_BY_NUMERIC_CODE

The currency units, identified by numeric code.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Set<CurrencyUnit>

Returns:

the corresponding CurrencyUnit, or null, if no such unit is provided by this provider.
getCurrencies
(CurrencyQuery
the javax.money.CurrencyQuery containing the parameters determining the query. not null.
currencyQuery
)

Implements javax.money.spi.CurrencyProviderSpi.getCurrencies.

Return a CurrencyUnit instances matching the given javax.money.CurrencyContext.

public static CurrencyUnit

Returns:

any unit instance registered previously by this instance, or null.
registerCurrencyUnit
(CurrencyUnit
the new currency to be registered, not null.
currencyUnit
)

Registers a new currency unit under its currency code and potentially numeric code.

public static CurrencyUnit

Returns:

any unit instance registered previously by this instance, or null.
registerCurrencyUnit
(CurrencyUnit
the new currency to be registered, not null.
currencyUnit
,
Locale
the Locale, not null.
locale
)

Registers a new currency unit under the given Locale.

public static CurrencyUnit

Returns:

any unit instance removed, or null.
removeCurrencyUnit
(String
the currency code, not null.
currencyCode
)

Removes a CurrencyUnit.

public static CurrencyUnit

Returns:

any unit instance removed, or null.
removeCurrencyUnit
(Locale
the Locale, not null.
locale
)

Removes a CurrencyUnit.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

CURRENCY_UNITSback to summary
private static final Map<String, CurrencyUnit> CURRENCY_UNITS

The currency units, identified by currency code.

CURRENCY_UNITS_BY_LOCALEback to summary
private static final Map<Locale, CurrencyUnit> CURRENCY_UNITS_BY_LOCALE

The currency units identified by Locale.

CURRENCY_UNITS_BY_NUMERIC_CODEback to summary
private static final Map<Integer, CurrencyUnit> CURRENCY_UNITS_BY_NUMERIC_CODE

The currency units, identified by numeric code.

Constructor Detail

ConfigurableCurrencyUnitProviderback to summary
public ConfigurableCurrencyUnitProvider()

Method Detail

getCurrenciesback to summary
public Set<CurrencyUnit> getCurrencies(CurrencyQuery currencyQuery)

Implements javax.money.spi.CurrencyProviderSpi.getCurrencies.

Return a CurrencyUnit instances matching the given javax.money.CurrencyContext.

Parameters
currencyQuery:CurrencyQuery

the javax.money.CurrencyQuery containing the parameters determining the query. not null.

Returns:Set<CurrencyUnit>

the corresponding CurrencyUnit, or null, if no such unit is provided by this provider.

registerCurrencyUnitback to summary
public static CurrencyUnit registerCurrencyUnit(CurrencyUnit currencyUnit)

Registers a new currency unit under its currency code and potentially numeric code.

Parameters
currencyUnit:CurrencyUnit

the new currency to be registered, not null.

Returns:CurrencyUnit

any unit instance registered previously by this instance, or null.

registerCurrencyUnitback to summary
public static CurrencyUnit registerCurrencyUnit(CurrencyUnit currencyUnit, Locale locale)

Registers a new currency unit under the given Locale.

Parameters
currencyUnit:CurrencyUnit

the new currency to be registered, not null.

locale:Locale

the Locale, not null.

Returns:CurrencyUnit

any unit instance registered previously by this instance, or null.

removeCurrencyUnitback to summary
public static CurrencyUnit removeCurrencyUnit(String currencyCode)

Removes a CurrencyUnit.

Parameters
currencyCode:String

the currency code, not null.

Returns:CurrencyUnit

any unit instance removed, or null.

removeCurrencyUnitback to summary
public static CurrencyUnit removeCurrencyUnit(Locale locale)

Removes a CurrencyUnit.

Parameters
locale:Locale

the Locale, not null.

Returns:CurrencyUnit

any unit instance removed, or null.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override