T - the target class implementing MonetaryAmount.public abstract class AbstractAmountFactory<T extends MonetaryAmount> extends Object implements MonetaryAmountFactory<T>
MonetaryAmountFactory, which simplifies development of the SPI interface.| Constructor and Description |
|---|
AbstractAmountFactory() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAmountType, getMaxNumber, getMinNumberpublic AbstractAmountFactory()
public T create()
MonetaryAmount, using the default MonetaryContext.create in interface MonetaryAmountFactory<T extends MonetaryAmount>MonetaryAmount combining the numeric value and currency unit.ArithmeticException - If the number exceeds the capabilities of the default MonetaryContext
used.protected abstract T create(Number number, CurrencyUnit currency, MonetaryContext monetaryContext)
protected abstract MonetaryContext loadDefaultMonetaryContext()
protected abstract MonetaryContext loadMaxMonetaryContext()
public MonetaryAmountFactory<T> setCurrency(CurrencyUnit currency)
setCurrency in interface MonetaryAmountFactory<T extends MonetaryAmount>public MonetaryAmountFactory<T> setNumber(Number number)
setNumber in interface MonetaryAmountFactory<T extends MonetaryAmount>public MonetaryAmountFactory<T> setCurrency(String currencyCode)
setCurrency in interface MonetaryAmountFactory<T extends MonetaryAmount>public MonetaryAmountFactory<T> setNumber(double number)
Monetary, using the default MonetaryContext.setNumber in interface MonetaryAmountFactory<T extends MonetaryAmount>number - numeric value.Money combining the numeric value and currency unit.ArithmeticException - If the number exceeds the capabilities of the default MonetaryContext
used.UnknownCurrencyException - if the currency code can not be resolved to CurrencyUnit.public MonetaryAmountFactory<T> setNumber(long number)
setNumber in interface MonetaryAmountFactory<T extends MonetaryAmount>public MonetaryAmountFactory<T> setContext(MonetaryContext monetaryContext)
setContext in interface MonetaryAmountFactory<T extends MonetaryAmount>public MonetaryContext getDefaultMonetaryContext()
MonetaryContext used, when no MonetaryContext is
provided.getDefaultMonetaryContext in interface MonetaryAmountFactory<T extends MonetaryAmount>MonetaryContext, never null.public MonetaryContext getMaximalMonetaryContext()
MonetaryContext supported.getMaximalMonetaryContext in interface MonetaryAmountFactory<T extends MonetaryAmount>MonetaryContext, never null.public MonetaryAmountFactory<T> setAmount(MonetaryAmount smount)
MonetaryAmount to a new MonetaryAmount
instance, hereby supporting the MonetaryContext given.setAmount in interface MonetaryAmountFactory<T extends MonetaryAmount>smount - the amount to be converted, if necessary.@Deprecated protected static BigDecimal getBigDecimal(Number num)
BigDecimal from the given Number doing the valid conversion
depending the type given.num - the number typeBigDecimalCopyright © 2012–2020 JavaMoney. All rights reserved.