public interface MonetaryAmountsSingletonSpi
SPI (core) for the backing implementation of the
Monetary
singleton. It
should load and manage (including contextual behavior), if needed) the different registered
MonetaryAmountFactory
instances.- Author:
- Anatole Tresch
-
Method Summary
Modifier and Type Method Description default java.util.Collection<MonetaryAmountFactory<?>>
getAmountFactories()
Get the currently registeredMonetaryAmount
implementation classes.<T extends MonetaryAmount>
MonetaryAmountFactory<T>getAmountFactory(java.lang.Class<T> amountType)
Access theMonetaryAmountFactory
for the givenamountType
.java.util.Collection<java.lang.Class<? extends MonetaryAmount>>
getAmountTypes()
Get the currently registeredMonetaryAmount
implementation types.default MonetaryAmountFactory<?>
getDefaultAmountFactory()
Access the defaultMonetaryAmountFactory
.java.lang.Class<? extends MonetaryAmount>
getDefaultAmountType()
Access the defaultMonetaryAmount
implementation type.
-
Method Details
-
getAmountFactory
<T extends MonetaryAmount> MonetaryAmountFactory<T> getAmountFactory(java.lang.Class<T> amountType)Access theMonetaryAmountFactory
for the givenamountType
.- Parameters:
amountType
- theMonetaryAmount
implementation type, targeted by the factory.- Returns:
- the
MonetaryAmountFactory
, ornull
, if no suchMonetaryAmountFactory
is available in the current context.
-
getDefaultAmountType
java.lang.Class<? extends MonetaryAmount> getDefaultAmountType()Access the defaultMonetaryAmount
implementation type.- Returns:
- a the default
MonetaryAmount
type corresponding, nevernull
. - Throws:
MonetaryException
- if noMonetaryAmountFactoryProviderSpi
is available, or noMonetaryAmountFactoryProviderSpi
targeting the configured defaultMonetaryAmount
type.- See Also:
Monetary.getDefaultAmountType()
-
getAmountTypes
java.util.Collection<java.lang.Class<? extends MonetaryAmount>> getAmountTypes()Get the currently registeredMonetaryAmount
implementation types.- Returns:
- the
Set
if registeredMonetaryAmount
implementations, nevernull
.
-
getDefaultAmountFactory
Access the defaultMonetaryAmountFactory
.- Returns:
- a the default
MonetaryAmount
type corresponding, nevernull
. - Throws:
MonetaryException
- if noMonetaryAmountFactoryProviderSpi
is available, or noMonetaryAmountFactoryProviderSpi
targeting the configured defaultMonetaryAmount
type.- See Also:
Monetary.getDefaultAmountType()
-
getAmountFactories
Get the currently registeredMonetaryAmount
implementation classes.- Returns:
- the
Set
if registeredMonetaryAmount
implementations, nevernull
.
-