net.sf.oness.common.model.accounting
Class Money
java.lang.Object
net.sf.oness.common.all.BaseObject
net.sf.oness.common.model.accounting.Money
- All Implemented Interfaces:
- java.lang.Cloneable, java.lang.Comparable, java.io.Serializable
- public class Money
- extends net.sf.oness.common.all.BaseObject
- implements java.lang.Comparable
Class for Money
- Version:
- $Revision: 1.1 $
- Author:
- Carlos Sanchez
- See Also:
BigDecimal
,
Currency
,
Serialized Form
Fields inherited from class net.sf.oness.common.all.BaseObject |
log |
Constructor Summary |
Money()
Create a money object with an amount of 0 and the currency
of the default locale as returned by Locale.getDefault() |
Money(java.math.BigDecimal amount,
java.util.Currency currency)
Create a money object with the specified amount and currency |
Money(java.util.Currency currency)
Create a money object with an amount of 0 and the specified
currency |
Methods inherited from class net.sf.oness.common.all.BaseObject |
clone, equals, hashCode, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Money
public Money()
- Create a money object with an amount of 0 and the currency
of the default locale as returned by
Locale.getDefault()
- See Also:
Locale.getDefault()
Money
public Money(java.math.BigDecimal amount,
java.util.Currency currency)
- Create a money object with the specified amount and currency
- Parameters:
amount
- currency
-
Money
public Money(java.util.Currency currency)
- Create a money object with an amount of 0 and the specified
currency
- Parameters:
currency
-
getAmount
public java.math.BigDecimal getAmount()
getCurrency
public java.util.Currency getCurrency()
add
public Money add(Money arg)
throws java.lang.IllegalArgumentException
- Parameters:
arg
-
- Returns:
-
- Throws:
java.lang.IllegalArgumentException
- if the currencies are not equal- See Also:
BigDecimal.add(BigDecimal)
subtract
public Money subtract(Money arg)
throws java.lang.IllegalArgumentException
- Parameters:
arg
-
- Returns:
-
- Throws:
java.lang.IllegalArgumentException
- if the currencies are not equal- See Also:
BigDecimal.subtract(BigDecimal)
negate
public Money negate()
- Returns:
-
- Throws:
java.lang.IllegalArgumentException
- if the currencies are not equal
multiply
public Money multiply(long arg)
compareTo
public int compareTo(java.lang.Object arg)
throws java.lang.IllegalArgumentException,
java.lang.ClassCastException
- Specified by:
compareTo
in interface java.lang.Comparable
- Throws:
java.lang.IllegalArgumentException
- if the currencies are not equal
java.lang.ClassCastException
- See Also:
Comparable.compareTo(java.lang.Object)
,
BigDecimal.compareTo(Object)
greaterThan
public boolean greaterThan(Money arg)
- Parameters:
arg
-
- Returns:
-
- Throws:
java.lang.IllegalArgumentException
- if the currencies are not equal
lessThan
public boolean lessThan(Money arg)
- Parameters:
arg
-
- Returns:
-
- Throws:
java.lang.IllegalArgumentException
- if the currencies are not equal
Copyright © 2003-2005 ONess Project. All Rights Reserved.