java.lang.Object
javax.money.format.MonetaryFormats
This class models the singleton accessor for
MonetaryAmountFormat instances.
This class is thread-safe.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThis class models the singleton accessor forMonetaryAmountFormatinstances. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MonetaryAmountFormatgetAmountFormat(String formatName, String... providers) Access the aMonetaryAmountFormatgiven its styleId.static MonetaryAmountFormatgetAmountFormat(Locale locale, String... providers) Access the defaultMonetaryAmountFormatgiven aLocale.static MonetaryAmountFormatgetAmountFormat(AmountFormatQuery formatQuery) Access the defaultMonetaryAmountFormatgiven aLocale.static Collection<MonetaryAmountFormat> getAmountFormats(AmountFormatQuery formatQuery) Access allMonetaryAmountFormatinstances that match the given aAmountFormatQuery.getAvailableLocales(String... providers) Get all available locales.Get the default provider chain, identified by the unique provider names in order as evaluated and used.static Collection<String> Get the names of the currently registered format providers.private static MonetaryFormatsSingletonSpistatic booleanisAvailable(Locale locale, String... providers) Checks if aMonetaryAmountFormatis available for the givenLocaleand providers.static booleanisAvailable(AmountFormatQuery formatQuery) Checks if aMonetaryAmountFormatis available for the givenAmountFormatQuery.private static MonetaryFormatsSingletonSpiLoads the SPI backing bean.
-
Constructor Details
-
MonetaryFormats
private MonetaryFormats()Private singleton constructor.
-
-
Method Details
-
getMonetaryFormatsSpi
-
loadMonetaryFormatsSingletonSpi
Loads the SPI backing bean.- Returns:
- the instance of MonetaryFormatsSingletonSpi to be used by this singleton.
-
isAvailable
Checks if aMonetaryAmountFormatis available for the givenLocaleand providers.- Parameters:
locale- the targetLocale, notnull.providers- The providers to be queried, if not set the providers as defined by #getDefaultCurrencyProviderChain() are queried.- Returns:
- true, if a corresponding
MonetaryAmountFormatis accessible.
-
getAmountFormat
Access the defaultMonetaryAmountFormatgiven aLocale.- Parameters:
locale- the targetLocale, notnull.providers- The providers to be queried, if not set the providers as defined by #getDefaultCurrencyProviderChain() are queried.- Returns:
- the matching
MonetaryAmountFormat - Throws:
MonetaryException- if no registeredMonetaryAmountFormatProviderSpican provide a correspondingMonetaryAmountFormatinstance.
-
isAvailable
Checks if aMonetaryAmountFormatis available for the givenAmountFormatQuery.- Parameters:
formatQuery- the requiredAmountFormatQuery, notnull. If the query does not define any explicit provider chain, the providers as defined by #getDefaultCurrencyProviderChain() are used.- Returns:
- true, if a corresponding
MonetaryAmountFormatis accessible.
-
getAmountFormat
Access the defaultMonetaryAmountFormatgiven aLocale.- Parameters:
formatQuery- the requiredAmountFormatQuery, notnull. If the query does not define any explicit provider chain, the providers as defined by #getDefaultCurrencyProviderChain() are used.- Returns:
- the matching
MonetaryAmountFormat - Throws:
MonetaryException- if no registeredMonetaryAmountFormatProviderSpican provide a correspondingMonetaryAmountFormatinstance.
-
getAmountFormats
Access allMonetaryAmountFormatinstances that match the given aAmountFormatQuery.- Parameters:
formatQuery- the requiredAmountFormatQuery, notnull. If the query does not define any explicit provider chain, the providers as defined by #getDefaultCurrencyProviderChain() are used.- Returns:
- the matching
MonetaryAmountFormat - Throws:
MonetaryException- if no registeredMonetaryAmountFormatProviderSpican provide a correspondingMonetaryAmountFormatinstance.
-
getAmountFormat
Access the aMonetaryAmountFormatgiven its styleId.- Parameters:
formatName- the target format name, notnull.providers- The providers to be used, if not set the providers as defined by #getDefaultCurrencyProviderChain() are used.- Returns:
- the matching
MonetaryAmountFormat - Throws:
MonetaryException- if no registeredMonetaryAmountFormatProviderSpican provide a correspondingMonetaryAmountFormatinstance.
-
getAvailableLocales
Get all available locales. This equals toMonetaryAmountFormatProviderSpi.getAvailableLocales().- Parameters:
providers- The providers to be used, if not set the providers as defined by #getDefaultCurrencyProviderChain() are used.- Returns:
- all available locales, never
null.
-
getFormatProviderNames
Get the names of the currently registered format providers.- Returns:
- the provider names, never null.
-
getDefaultFormatProviderChain
Get the default provider chain, identified by the unique provider names in order as evaluated and used.- Returns:
- the default provider chain, never null.
-