Module java.money
Package javax.money.format
Class MonetaryFormats.DefaultMonetaryFormatsSingletonSpi
java.lang.Object
javax.money.format.MonetaryFormats.DefaultMonetaryFormatsSingletonSpi
- All Implemented Interfaces:
MonetaryFormatsSingletonSpi
- Enclosing class:
- MonetaryFormats
public static final class MonetaryFormats.DefaultMonetaryFormatsSingletonSpi extends java.lang.Object implements MonetaryFormatsSingletonSpi
This class models the singleton accessor for
MonetaryAmountFormat
instances.
This class is thread-safe.
- Author:
- Anatole Tresch, Werner Keil
-
Constructor Summary
Constructors Constructor Description DefaultMonetaryFormatsSingletonSpi()
-
Method Summary
Modifier and Type Method Description java.util.Collection<MonetaryAmountFormat>
getAmountFormats(AmountFormatQuery formatQuery)
Access anMonetaryAmountFormat
given a.AmountFormatContext
.java.util.Set<java.util.Locale>
getAvailableLocales(java.lang.String... providerNames)
Get all available locales.java.util.List<java.lang.String>
getDefaultProviderChain()
This default implementation simply returns all providers defined in arbitrary order.java.util.Set<java.lang.String>
getProviderNames()
Get the names of the currently registered format providers.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.money.spi.MonetaryFormatsSingletonSpi
getAmountFormat, getAmountFormat, getAmountFormat, isAvailable, isAvailable
-
Constructor Details
-
DefaultMonetaryFormatsSingletonSpi
public DefaultMonetaryFormatsSingletonSpi()
-
-
Method Details
-
getAmountFormats
Access anMonetaryAmountFormat
given a.AmountFormatContext
.- Specified by:
getAmountFormats
in interfaceMonetaryFormatsSingletonSpi
- 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.
-
getProviderNames
public java.util.Set<java.lang.String> getProviderNames()Description copied from interface:MonetaryFormatsSingletonSpi
Get the names of the currently registered format providers.- Specified by:
getProviderNames
in interfaceMonetaryFormatsSingletonSpi
- Returns:
- the provider names, never null.
-
getDefaultProviderChain
public java.util.List<java.lang.String> getDefaultProviderChain()This default implementation simply returns all providers defined in arbitrary order.- Specified by:
getDefaultProviderChain
in interfaceMonetaryFormatsSingletonSpi
- Returns:
- the default provider chain, never null.
-
getAvailableLocales
public java.util.Set<java.util.Locale> getAvailableLocales(java.lang.String... providerNames)Get all available locales. This equals to.MonetaryAmountFormatProviderSpi#getAvailableLocales()
.- Specified by:
getAvailableLocales
in interfaceMonetaryFormatsSingletonSpi
- Parameters:
providerNames
- The (optional) providers to be used, ordered correspondingly.- Returns:
- all available locales, never
null
.
-