org.nakedobjects.applib.value
Class Money

java.lang.Object
  extended by org.nakedobjects.applib.value.Magnitude
      extended by org.nakedobjects.applib.value.Money
All Implemented Interfaces:
java.io.Serializable

public class Money
extends Magnitude

See Also:
Serialized Form

Constructor Summary
Money(double amount, java.lang.String currency)
           
Money(long amount, java.lang.String currency)
           
 
Method Summary
 Money add(Money money)
          Add the specified money to this money.
 double doubleValue()
          Returns this value as a double.
 boolean equals(Money other)
           
 boolean equals(java.lang.Object other)
           
 float floatValue()
          Returns this value as a float.
 java.math.BigDecimal getAmount()
           
 java.lang.String getCurrency()
           
 int hashCode()
           
 boolean hasSameCurrency(Money money)
           
 int intValue()
          Returns this value as an int.
 boolean isEqualTo(Magnitude magnitude)
           
 boolean isGreaterThanZero()
           
 boolean isLessThan(Magnitude magnitude)
           
 boolean isLessThanZero()
          Returns true if this value is less than zero.
 boolean isZero()
           
 long longValue()
          Returns this value as an long.
 Money subtract(Money money)
          Subtract the specified amount from this value.
 java.lang.String toString()
           
 
Methods inherited from class org.nakedobjects.applib.value.Magnitude
isBetween, isGreaterThan, isGreaterThanOrEqualTo, isLessThanOrEqualTo, max, min
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Money

public Money(double amount,
             java.lang.String currency)

Money

public Money(long amount,
             java.lang.String currency)
Method Detail

add

public Money add(Money money)
Add the specified money to this money.


doubleValue

public double doubleValue()
Returns this value as a double.


floatValue

public float floatValue()
Returns this value as a float.


getAmount

public java.math.BigDecimal getAmount()

getCurrency

public java.lang.String getCurrency()

hasSameCurrency

public boolean hasSameCurrency(Money money)

intValue

public int intValue()
Returns this value as an int.


isEqualTo

public boolean isEqualTo(Magnitude magnitude)
Specified by:
isEqualTo in class Magnitude

isGreaterThanZero

public boolean isGreaterThanZero()

isLessThan

public boolean isLessThan(Magnitude magnitude)
Specified by:
isLessThan in class Magnitude

isLessThanZero

public boolean isLessThanZero()
Returns true if this value is less than zero.


isZero

public boolean isZero()

longValue

public long longValue()
Returns this value as an long.


subtract

public Money subtract(Money money)
Subtract the specified amount from this value.


equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

equals

public boolean equals(Money other)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.