public interface MonetaryAmountsSpi
MonetaryAmounts singleton. It
should load and manage (including contextual behavior), if needed) the different registered
MonetaryAmountFactory instances.| Modifier and Type | Method and Description |
|---|---|
<T extends MonetaryAmount> |
getAmountFactory(java.lang.Class<T> amountType)
Access the
MonetaryAmountFactory for the given amountType . |
java.util.Set<java.lang.Class<? extends MonetaryAmount>> |
getAmountTypes()
Get the currently registered
MonetaryAmount implementation types. |
java.lang.Class<? extends MonetaryAmount> |
getDefaultAmountType()
Access the default
MonetaryAmount type. |
java.lang.Class<? extends MonetaryAmount> |
queryAmountType(MonetaryContext requiredContext)
Get the
MonetaryAmount implementation class, that best matches to cover the given
MonetaryContext. |
<T extends MonetaryAmount> MonetaryAmountFactory<T> getAmountFactory(java.lang.Class<T> amountType)
MonetaryAmountFactory for the given amountType .amountType - the MonetaryAmount implementation type, targeted by the factory.MonetaryAmountFactory, or null, if no such
MonetaryAmountFactory is available in the current context.java.util.Set<java.lang.Class<? extends MonetaryAmount>> getAmountTypes()
MonetaryAmount implementation types.Set if registered MonetaryAmount implementation types, never
null.java.lang.Class<? extends MonetaryAmount> getDefaultAmountType()
MonetaryAmount type.MonetaryAmount type corresponding, never null.MonetaryException - if no MonetaryAmountFactoryProviderSpi is available, or no
MonetaryAmountFactoryProviderSpi targeting the configured default
MonetaryAmount type.MonetaryAmounts.getDefaultAmountType()java.lang.Class<? extends MonetaryAmount> queryAmountType(MonetaryContext requiredContext)
MonetaryAmount implementation class, that best matches to cover the given
MonetaryContext.
The evaluation order should consider the following aspects:
MonetaryContext.getAmountType() is defined, it should be considered.
Nevertheless if precision/scale cannot be met, a MonetaryException should
be thrown.
precision==0 (unlimited precision), the
MonetaryAmount implementation candidate should be chosen with highest possible
precision.
Flavor.PERFORMANCE are preferred.
requiredContext - the required MonetaryContextMonetaryAmount implementation class, that best matches to cover the given
MonetaryContext, never null.MonetaryException - if no MonetaryAmount implementation class can cover the required
MonetaryContext.