© 2002 BEA Systems, Inc.


com.bea.commerce.ebusiness.price.quote
Class AbstractMoney

java.lang.Object
  |
  +--com.bea.commerce.ebusiness.price.quote.AbstractMoney
Direct Known Subclasses:
ImmutableMoney, MutableMoney

public abstract class AbstractMoney
extends java.lang.Object
implements Money

See Also:
Serialized Form

Field Summary
static java.lang.String NO_CURRENCY
           
static double ZERO
           
 
Constructor Summary
AbstractMoney()
           
 
Method Summary
static int compare(Money moneyA, Money moneyB)
          Compares to money objects.
 boolean equals(java.lang.Object object)
          Compares the specified object with this object.
abstract  java.lang.String getCurrency()
           
abstract  double getValue()
           
 java.lang.String toString()
          Returns a string containing the value and currency of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO

public static final double ZERO

NO_CURRENCY

public static final java.lang.String NO_CURRENCY
Constructor Detail

AbstractMoney

public AbstractMoney()
Method Detail

compare

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.
Throws:
CurrencyMismatchException - if the currencies of the two Money objects differ.
See Also:
Money, CurrencyMismatchException

getValue

public abstract double getValue()
Specified by:
getValue in interface Money

Returns:
the amount of money

getCurrency

public abstract java.lang.String getCurrency()
Specified by:
getCurrency in interface Money

Returns:
the currency string.

equals

public boolean equals(java.lang.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.

Parameters:
object -  
Returns:
true if the specified object implements the Money interface and has the same currency as this object.
Overrides:
equals in class java.lang.Object
See Also:
Money

toString

public java.lang.String toString()
Returns a string containing the value and currency of the object.

Returns:
the value and currency of the object as a String
Overrides:
toString in class java.lang.Object

© 2002 BEA Systems, Inc.

Copyright © 2002 BEA Systems, Inc. All Rights Reserved