- 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 MonetaryAmountFormat
getAmountFormat(java.lang.String formatName, java.lang.String... providers)
Access the defaultMonetaryAmountFormat
given aLocale
.default MonetaryAmountFormat
getAmountFormat(java.util.Locale locale, java.lang.String... providers)
Access the defaultMonetaryAmountFormat
given aLocale
.default MonetaryAmountFormat
getAmountFormat(AmountFormatQuery formatQuery)
Access anMonetaryAmountFormat
given a.AmountFormatQuery
.java.util.Collection<MonetaryAmountFormat>
getAmountFormats(AmountFormatQuery formatQuery)
Access allMonetaryAmountFormat
instances 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 boolean
isAvailable(java.util.Locale locale, java.lang.String... providers)
Checks if aMonetaryAmountFormat
is available given a.AmountFormatQuery
.default boolean
isAvailable(AmountFormatQuery formatQuery)
Checks if aMonetaryAmountFormat
is 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 allMonetaryAmountFormat
instances matching the given.AmountFormatQuery
.- Parameters:
formatQuery
- The format query defining the requirements of the formatter.- Returns:
- the corresponding
MonetaryAmountFormat
instances, 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 anMonetaryAmountFormat
given a.AmountFormatQuery
.- Parameters:
formatQuery
- The format query defining the requirements of the formatter.- Returns:
- the corresponding
MonetaryAmountFormat
- Throws:
MonetaryException
- if no registered.MonetaryAmountFormatProviderSpi
can provide a correspondingMonetaryAmountFormat
instance.
-
isAvailable
Checks if aMonetaryAmountFormat
is available given a.AmountFormatQuery
.- Parameters:
formatQuery
- The format query defining the requirements of the formatter.- Returns:
- true, if a t least one
MonetaryAmountFormat
is matching the query.
-
isAvailable
default boolean isAvailable(java.util.Locale locale, java.lang.String... providers)Checks if aMonetaryAmountFormat
is 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
MonetaryAmountFormat
is matching the query.
-
getAmountFormat
default MonetaryAmountFormat getAmountFormat(java.util.Locale locale, java.lang.String... providers)Access the defaultMonetaryAmountFormat
given aLocale
.- Parameters:
locale
- the targetLocale
, notnull
.providers
- The (optional) providers to be used, ordered correspondingly.- Returns:
- the matching
MonetaryAmountFormat
- Throws:
MonetaryException
- if no registeredMonetaryAmountFormatProviderSpi
can provide a correspondingMonetaryAmountFormat
instance.
-
getAmountFormat
default MonetaryAmountFormat getAmountFormat(java.lang.String formatName, java.lang.String... providers)Access the defaultMonetaryAmountFormat
given 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 registeredMonetaryAmountFormatProviderSpi
can provide a correspondingMonetaryAmountFormat
instance.
-