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 registeredMonetaryAmountimplementation classes.<T extends MonetaryAmount>
MonetaryAmountFactory<T>getAmountFactory(java.lang.Class<T> amountType)Access theMonetaryAmountFactoryfor the givenamountType.java.util.Collection<java.lang.Class<? extends MonetaryAmount>>getAmountTypes()Get the currently registeredMonetaryAmountimplementation types.default MonetaryAmountFactory<?>getDefaultAmountFactory()Access the defaultMonetaryAmountFactory.java.lang.Class<? extends MonetaryAmount>getDefaultAmountType()Access the defaultMonetaryAmountimplementation type.
-
Method Details
-
getAmountFactory
<T extends MonetaryAmount> MonetaryAmountFactory<T> getAmountFactory(java.lang.Class<T> amountType)Access theMonetaryAmountFactoryfor the givenamountType.- Parameters:
amountType- theMonetaryAmountimplementation type, targeted by the factory.- Returns:
- the
MonetaryAmountFactory, ornull, if no suchMonetaryAmountFactoryis available in the current context.
-
getDefaultAmountType
java.lang.Class<? extends MonetaryAmount> getDefaultAmountType()Access the defaultMonetaryAmountimplementation type.- Returns:
- a the default
MonetaryAmounttype corresponding, nevernull. - Throws:
MonetaryException- if noMonetaryAmountFactoryProviderSpiis available, or noMonetaryAmountFactoryProviderSpitargeting the configured defaultMonetaryAmounttype.- See Also:
Monetary.getDefaultAmountType()
-
getAmountTypes
java.util.Collection<java.lang.Class<? extends MonetaryAmount>> getAmountTypes()Get the currently registeredMonetaryAmountimplementation types.- Returns:
- the
Setif registeredMonetaryAmountimplementations, nevernull.
-
getDefaultAmountFactory
Access the defaultMonetaryAmountFactory.- Returns:
- a the default
MonetaryAmounttype corresponding, nevernull. - Throws:
MonetaryException- if noMonetaryAmountFactoryProviderSpiis available, or noMonetaryAmountFactoryProviderSpitargeting the configured defaultMonetaryAmounttype.- See Also:
Monetary.getDefaultAmountType()
-
getAmountFactories
Get the currently registeredMonetaryAmountimplementation classes.- Returns:
- the
Setif registeredMonetaryAmountimplementations, nevernull.
-