Package org.cyclos.entities.utils
Class CurrencyAmount
- java.lang.Object
-
- org.cyclos.entities.utils.CurrencyAmount
-
- All Implemented Interfaces:
Comparable<CurrencyAmount>,HasCurrency,HasCurrencyAmount,ProcessableForProxying,ICurrencyAmount,HasAmount
- Direct Known Subclasses:
RatedCurrencyAmount
@Embeddable public class CurrencyAmount extends Object implements ICurrencyAmount, HasCurrencyAmount, ProcessableForProxying, Comparable<CurrencyAmount>
Contains both an amount and a currency
-
-
Field Summary
Fields Modifier and Type Field Description static Comparator<CurrencyAmount>COMPARATOR
-
Constructor Summary
Constructors Constructor Description CurrencyAmount()CurrencyAmount(Currency currency, BigDecimal amount)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CurrencyAmountabs()intcompareTo(CurrencyAmount o)booleanequals(Object obj)BigDecimalgetAmount()CurrencygetCurrency()CurrencyAmountgetCurrencyAmount()inthashCode()static CurrencyAmountof(Currency currency, BigDecimal amount)Creates a new instance.voidsetAmount(BigDecimal amount)voidsetCurrency(Currency currency)-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.cyclos.entities.banking.HasCurrency
round, withCurrency
-
Methods inherited from interface org.cyclos.entities.ProcessableForProxying
getProxyClass
-
-
-
-
Field Detail
-
COMPARATOR
public static final Comparator<CurrencyAmount> COMPARATOR
-
-
Constructor Detail
-
CurrencyAmount
public CurrencyAmount()
-
CurrencyAmount
public CurrencyAmount(Currency currency, BigDecimal amount)
-
-
Method Detail
-
of
public static CurrencyAmount of(Currency currency, BigDecimal amount)
Creates a new instance. When either currency or amount are null, returns null.
-
abs
public CurrencyAmount abs()
-
compareTo
public int compareTo(CurrencyAmount o)
- Specified by:
compareToin interfaceComparable<CurrencyAmount>
-
getAmount
public BigDecimal getAmount()
-
getCurrency
public Currency getCurrency()
- Specified by:
getCurrencyin interfaceHasCurrency- Specified by:
getCurrencyin interfaceICurrencyAmount
-
getCurrencyAmount
public CurrencyAmount getCurrencyAmount()
- Specified by:
getCurrencyAmountin interfaceHasCurrencyAmount
-
setAmount
public void setAmount(BigDecimal amount)
-
setCurrency
public void setCurrency(Currency currency)
-
-