AbstractMoney Class
- public abstract class AbstractMoney
extends Object
implements Money
-
Hierarchy
-
Object
AbstractMoney
-
All Implemented Interfaces
-
Money
, Serializable
-
Direct Known Subclasses
-
ImmutableMoney
, MutableMoney
NO_CURRENCY
public static final String
NO_CURRENCY
ZERO
public static final double ZERO
AbstractMoney
public AbstractMoney()
compare(Money, Money) Method
public static int compare(Money
moneyA,
Money
moneyB)
throws CurrencyMismatchException
Compares to money objects.
Parameters
-
moneyA
- a Money object
-
moneyB
- a Money object
Returns
- -1, 0, or 1 corresponding to the contract for
the Comparator interface.
Exceptions
-
CurrencyMismatchException
- if the currencies
of the two Money objects differ.
Related Topics
Money
CurrencyMismatchException
equals(Object) Method
public boolean equals(Object
object)
Compares the specified object with this object.
This method will return true if the specified
object implements the Money interface and
has the same currency and amount as this object.
-
Overrides
-
Object.equals(Object)
Returns
- true if the specified object implements
the Money interface and has the same currency as
this object.
Related Topics
Money
getCurrency() Method
public abstract String
getCurrency()
Returns
- the currency string.
getValue() Method
public abstract double getValue()
Returns
- the amount of money
toString() Method
public String
toString()
Returns a string containing the value and currency of
the object.
-
Overrides
-
Object.toString()
Returns
- the value and currency of the object as a String