public final class DummyAmountFactory extends java.lang.Object implements MonetaryAmountFactory<DummyAmount>
MonetaryAmounts
singleton's delegation
logic.Constructor and Description |
---|
DummyAmountFactory() |
Modifier and Type | Method and Description |
---|---|
DummyAmount |
create()
Creates a new instance of
MonetaryAmount , using the current data set on this factory. |
java.lang.Class<DummyAmount> |
getAmountType()
Access the
MonetaryAmount implementation type. |
MonetaryContext |
getDefaultMonetaryContext()
Returns the default
MonetaryContext used, when no MonetaryContext is
provided. |
MonetaryContext |
getMaximalMonetaryContext()
Returns the maximal
MonetaryContext supported, for requests that exceed these maximal
capabilities, an ArithmeticException must be thrown. |
DummyAmountFactory |
setAmount(MonetaryAmount amount)
Uses an arbitrary
MonetaryAmount to initialize this factory. |
DummyAmountFactory |
setContext(MonetaryContext monetaryContext)
Sets the
MonetaryContext to be used. |
DummyAmountFactory |
setCurrency(CurrencyUnit currency)
Sets the
CurrencyUnit to be used. |
DummyAmountFactory |
setCurrency(java.lang.String currencyCode)
Sets the
CurrencyUnit to be used. |
DummyAmountFactory |
setNumber(double number)
Sets the number to be used.
|
DummyAmountFactory |
setNumber(long number)
Sets the number to be used.
|
DummyAmountFactory |
setNumber(java.lang.Number number)
Sets the number to be used.
|
public java.lang.Class<DummyAmount> getAmountType()
MonetaryAmountFactory
MonetaryAmount
implementation type.getAmountType
in interface MonetaryAmountFactory<DummyAmount>
MonetaryAmount
implementation type, never null
.public MonetaryContext getDefaultMonetaryContext()
MonetaryAmountFactory
MonetaryContext
used, when no MonetaryContext
is
provided.
The default context is not allowed to exceed the capabilities of the maximal
MonetaryContext
supported.
getDefaultMonetaryContext
in interface MonetaryAmountFactory<DummyAmount>
MonetaryContext
, never null
.MonetaryAmountFactory.getMaximalMonetaryContext()
public MonetaryContext getMaximalMonetaryContext()
MonetaryAmountFactory
MonetaryContext
supported, for requests that exceed these maximal
capabilities, an ArithmeticException
must be thrown.getMaximalMonetaryContext
in interface MonetaryAmountFactory<DummyAmount>
MonetaryContext
supported, never null
public DummyAmountFactory setCurrency(java.lang.String currencyCode)
MonetaryAmountFactory
CurrencyUnit
to be used.setCurrency
in interface MonetaryAmountFactory<DummyAmount>
currencyCode
- the currencyCode of the currency to be used, not null
. The currency code
will be resolved using MonetaryCurrencies.getCurrency(String)
.public DummyAmountFactory setCurrency(CurrencyUnit currency)
MonetaryAmountFactory
CurrencyUnit
to be used.setCurrency
in interface MonetaryAmountFactory<DummyAmount>
currency
- the CurrencyUnit
to be used, not null
public DummyAmount create()
MonetaryAmountFactory
MonetaryAmount
, using the current data set on this factory.create
in interface MonetaryAmountFactory<DummyAmount>
MonetaryAmount
.MonetaryAmountFactory.getAmountType()
public DummyAmountFactory setNumber(double number)
MonetaryAmountFactory
setNumber
in interface MonetaryAmountFactory<DummyAmount>
number
- the number to be usedpublic DummyAmountFactory setNumber(long number)
MonetaryAmountFactory
setNumber
in interface MonetaryAmountFactory<DummyAmount>
number
- the number to be usedpublic DummyAmountFactory setNumber(java.lang.Number number)
MonetaryAmountFactory
setNumber
in interface MonetaryAmountFactory<DummyAmount>
number
- the number to be used, not null
.public DummyAmountFactory setContext(MonetaryContext monetaryContext)
MonetaryAmountFactory
MonetaryContext
to be used.setContext
in interface MonetaryAmountFactory<DummyAmount>
monetaryContext
- the MonetaryContext
to be used, not null
.MonetaryAmountFactory.getMaximalMonetaryContext()
public DummyAmountFactory setAmount(MonetaryAmount amount)
MonetaryAmountFactory
MonetaryAmount
to initialize this factory. Properties reused are:
setAmount
in interface MonetaryAmountFactory<DummyAmount>
amount
- the amount to be used, not null
.