public final class MonetaryAmounts
extends java.lang.Object
MonetaryAmount
instances as provided by the different registered
MonetaryAmountFactory
instances.
This singleton allows to get MonetaryAmountFactory
instances for the registered
MonetaryAmount
implementation classes or depending on the precision and scale
requirements.
Modifier and Type | Method and Description |
---|---|
static MonetaryAmountFactory<?> |
getAmountFactory()
Access the default
MonetaryAmountFactory as defined by
getDefaultAmountType() . |
static <T extends MonetaryAmount> |
getAmountFactory(java.lang.Class<T> amountType)
Access an
MonetaryAmountFactory for the given MonetaryAmount implementation
type. |
static java.util.Set<java.lang.Class<? extends MonetaryAmount>> |
getAmountTypes()
Access all currently available
MonetaryAmount implementation classes that are
accessible from this MonetaryAmount singleton. |
static java.lang.Class<? extends MonetaryAmount> |
getDefaultAmountType()
Access the default
MonetaryAmount type. |
static java.lang.Class<? extends MonetaryAmount> |
queryAmountType(MonetaryContext requiredContext)
Get the
MonetaryAmount implementation class, that best matches to cover the given
MonetaryContext . |
public static MonetaryAmountFactory<?> getAmountFactory()
MonetaryAmountFactory
as defined by
getDefaultAmountType()
.MonetaryAmountFactory
corresponding to getDefaultAmountType()
,
never null
.MonetaryException
- if no MonetaryAmountFactory
targeting the getDefaultAmountType()
implementation class is registered.public static <T extends MonetaryAmount> MonetaryAmountFactory<T> getAmountFactory(java.lang.Class<T> amountType)
MonetaryAmountFactory
for the given MonetaryAmount
implementation
type.amountType
- MonetaryAmount
implementation type, nor null
.MonetaryAmountFactory
, never null
.MonetaryException
- if no MonetaryAmountFactory
targeting the given MonetaryAmount
implementation class is registered.public static java.util.Set<java.lang.Class<? extends MonetaryAmount>> getAmountTypes()
MonetaryAmount
implementation classes that are
accessible from this MonetaryAmount
singleton.MonetaryAmount
implementation classes that have
corresponding MonetaryAmountFactory
instances provided, never null
public static 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.public static java.lang.Class<? extends MonetaryAmount> queryAmountType(MonetaryContext requiredContext)
MonetaryAmount
implementation class, that best matches to cover the given
MonetaryContext
.requiredContext
- the MonetaryContext
to be queried for a matching MonetaryAmount
implementation, notnull
.MonetaryAmount
implementation class, that best matches to cover the given
MonetaryContext
, never null
.MonetaryException
- if no MonetaryAmount
implementation class can cover the required
MonetaryContext
.