public class DefaultMonetaryAmountsSpi extends java.lang.Object implements MonetaryAmountsSpi
Constructor and Description |
---|
DefaultMonetaryAmountsSpi() |
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 . |
public <T extends MonetaryAmount> MonetaryAmountFactory<T> getAmountFactory(java.lang.Class<T> amountType)
MonetaryAmountsSpi
MonetaryAmountFactory
for the given amountType
.getAmountFactory
in interface MonetaryAmountsSpi
amountType
- the MonetaryAmount
implementation type, targeted by the factory.MonetaryAmountFactory
, or null
, if no such
MonetaryAmountFactory
is available in the current context.public java.util.Set<java.lang.Class<? extends MonetaryAmount>> getAmountTypes()
MonetaryAmountsSpi
MonetaryAmount
implementation types.getAmountTypes
in interface MonetaryAmountsSpi
Set
if registered MonetaryAmount
implementation types, never
null
.public java.lang.Class<? extends MonetaryAmount> queryAmountType(MonetaryContext requiredContext)
MonetaryAmountsSpi
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.
queryAmountType
in interface MonetaryAmountsSpi
requiredContext
- the required MonetaryContext
MonetaryAmount
implementation class, that best matches to cover the given
MonetaryContext
, never null
.public java.lang.Class<? extends MonetaryAmount> getDefaultAmountType()
MonetaryAmountsSpi
MonetaryAmount
type.getDefaultAmountType
in interface MonetaryAmountsSpi
MonetaryAmount
type corresponding, never null
.MonetaryAmounts.getDefaultAmountType()