- All Known Implementing Classes:
MonetaryFormats.DefaultMonetaryFormatsSingletonSpi
public interface MonetaryFormatsSingletonSpi
This interface models the singleton functionality of
MonetaryFormats.
Implementations of this interface must be thread-safe.
- Author:
- Anatole Tresch, Werner Keil
-
Method Summary
Modifier and Type Method Description default MonetaryAmountFormatgetAmountFormat(java.lang.String formatName, java.lang.String... providers)Access the defaultMonetaryAmountFormatgiven aLocale.default MonetaryAmountFormatgetAmountFormat(java.util.Locale locale, java.lang.String... providers)Access the defaultMonetaryAmountFormatgiven aLocale.default MonetaryAmountFormatgetAmountFormat(AmountFormatQuery formatQuery)Access anMonetaryAmountFormatgiven a.AmountFormatQuery.java.util.Collection<MonetaryAmountFormat>getAmountFormats(AmountFormatQuery formatQuery)Access allMonetaryAmountFormatinstances matching the given.AmountFormatQuery.java.util.Set<java.util.Locale>getAvailableLocales(java.lang.String... providers)Get all available locales.java.util.List<java.lang.String>getDefaultProviderChain()Get the default provider chain, identified by the unique provider names in order as evaluated and used.java.util.Set<java.lang.String>getProviderNames()Get the names of the currently registered format providers.default booleanisAvailable(java.util.Locale locale, java.lang.String... providers)Checks if aMonetaryAmountFormatis available given a.AmountFormatQuery.default booleanisAvailable(AmountFormatQuery formatQuery)Checks if aMonetaryAmountFormatis available given a.AmountFormatQuery.
-
Method Details
-
getAvailableLocales
java.util.Set<java.util.Locale> getAvailableLocales(java.lang.String... providers)Get all available locales. This equals toMonetaryAmountFormatProviderSpi.getAvailableLocales().- Parameters:
providers- The (optional) providers to be used, ordered correspondingly.- Returns:
- all available locales, never
null.
-
getAmountFormats
Access allMonetaryAmountFormatinstances matching the given.AmountFormatQuery.- Parameters:
formatQuery- The format query defining the requirements of the formatter.- Returns:
- the corresponding
MonetaryAmountFormatinstances, never null
-
getProviderNames
java.util.Set<java.lang.String> getProviderNames()Get the names of the currently registered format providers.- Returns:
- the provider names, never null.
-
getDefaultProviderChain
java.util.List<java.lang.String> getDefaultProviderChain()Get the default provider chain, identified by the unique provider names in order as evaluated and used.- Returns:
- the default provider chain, never null.
-
getAmountFormat
Access anMonetaryAmountFormatgiven a.AmountFormatQuery.- Parameters:
formatQuery- The format query defining the requirements of the formatter.- Returns:
- the corresponding
MonetaryAmountFormat - Throws:
MonetaryException- if no registered.MonetaryAmountFormatProviderSpican provide a correspondingMonetaryAmountFormatinstance.
-
isAvailable
Checks if aMonetaryAmountFormatis available given a.AmountFormatQuery.- Parameters:
formatQuery- The format query defining the requirements of the formatter.- Returns:
- true, if a t least one
MonetaryAmountFormatis matching the query.
-
isAvailable
default boolean isAvailable(java.util.Locale locale, java.lang.String... providers)Checks if aMonetaryAmountFormatis available given a.AmountFormatQuery.- Parameters:
locale- the targetLocale, notnull.providers- The (optional) providers to be used, ordered correspondingly.- Returns:
- true, if a t least one
MonetaryAmountFormatis matching the query.
-
getAmountFormat
default MonetaryAmountFormat getAmountFormat(java.util.Locale locale, java.lang.String... providers)Access the defaultMonetaryAmountFormatgiven aLocale.- Parameters:
locale- the targetLocale, notnull.providers- The (optional) providers to be used, ordered correspondingly.- Returns:
- the matching
MonetaryAmountFormat - Throws:
MonetaryException- if no registeredMonetaryAmountFormatProviderSpican provide a correspondingMonetaryAmountFormatinstance.
-
getAmountFormat
default MonetaryAmountFormat getAmountFormat(java.lang.String formatName, java.lang.String... providers)Access the defaultMonetaryAmountFormatgiven aLocale.- Parameters:
formatName- the target format name, notnull.providers- The (optional) providers to be used, ordered correspondingly.- Returns:
- the matching
MonetaryAmountFormat - Throws:
MonetaryException- if no registeredMonetaryAmountFormatProviderSpican provide a correspondingMonetaryAmountFormatinstance.
-