MutableMoney Class

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

public class MutableMoney

    extends AbstractMoney
    implements Cloneable

A money object that may have it's amount and currency modified.


Hierarchy
Object
  AbstractMoney
    MutableMoney
All Implemented Interfaces

Cloneable, Money, Serializable

Field Summary

   
Fields from  com.bea.commerce.ebusiness.price.quote.AbstractMoney
NO_CURRENCY, ZERO
 

Constructor Summary

MutableMoney()

Constructs a new MutableMoney object with a value of zero and a currency of "NoCurrency".
MutableMoney(double value, String currency)

Constructs a new MutableMoney object with a value and currency as specified by the given parameters.
 

Method Summary

public MutableMoney
add(double value)
Adds the specified value to this money object.
public MutableMoney
add(Money value)
Adds the specified Money object to this money object if the two objects have the same currency.
public static MutableMoney
copyFromAxiomMoney(Money from, MutableMoney to)
Copies the values from the first parameter to the second parameter and returns the second parameter.
public static MutableMoney
create(Money axiomMoney)
Create a new money object from the com.beasys.commerce.axiom.units.Money object passed in.
public static MutableMoney
create(Money money, double value)
Create a new money object.
public static MutableMoney
create(Money money)
Create a new immutable money object.
public String
getCurrency()
public double
getValue()
public MutableMoney
set(double value, String currency)
Sets the value and currency of the object specified by the given parameters.
public MutableMoney
set(Money money, double value)
Sets the value and currency of the object specified by the given parameters.
public MutableMoney
set(Money money)
Sets this object based on the values of the specified Money object.
public void
setCurrency(String currency)
Set the currency for this money object
public void
setValue(double value)
Set the amount for this money object
public String
toString()
Returns the class of the object and the value and currency of the object.
 
Methods from  com.bea.commerce.ebusiness.price.quote.AbstractMoney
compare, equals,
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
   
Methods from interface com.bea.commerce.ebusiness.price.quote.Money
getCurrency, getValue
 

Constructor Detail

MutableMoney

public MutableMoney()
Constructs a new MutableMoney object with a value of zero and a currency of "NoCurrency".

Related Topics

AbstractMoney


MutableMoney

public MutableMoney(double value, 
                    String currency)
Constructs a new MutableMoney object with a value and currency as specified by the given parameters.
 

Method Detail

add(double) Method

public MutableMoney add(double value)
Adds the specified value to this money object.

Parameters

value
the amount of money to add to this object

Returns

this money object

add(Money) Method

public MutableMoney add(Money value)
throws CurrencyMismatchException
Adds the specified Money object to this money object if the two objects have the same currency. If the currencies differ a CurrencyMismatchException will be thrown.

Parameters

value
the amount of money to add to this object

Returns

this money object

Exceptions

CurrencyMismatchException

copyFromAxiomMoney(Money, MutableMoney) Method

public static MutableMoney copyFromAxiomMoney(Money from, 
                                              MutableMoney to)
Copies the values from the first parameter to the second parameter and returns the second parameter.

Parameters

from
a com.beasys.commerce.axiom.units.Money object to copy the values from
to
a Money object to copy the from values to

Returns

new the to object with the new values

Related Topics

Money


create(Money) Method

public static MutableMoney create(Money axiomMoney)
Create a new money object from the com.beasys.commerce.axiom.units.Money object passed in.

Parameters

axiomMoney
a money object

Returns

a new MutableMoney object

Related Topics

Money


create(Money, double) Method

public static MutableMoney create(Money money, 
                                  double value)
Create a new money object. The currency is obtained from the money object specified and the value of the new object will match the value specified.

Parameters

money
a money object
value
the amount of the new money object

Returns

a new MutableMoney object

Related Topics

Money


create(Money) Method

public static MutableMoney create(Money money)
Create a new immutable money object. The values for the new object will be obtained from the specified money object.

Parameters

money
a money object

Returns

a new MutableMoney object

Related Topics

Money


getCurrency() Method

public String getCurrency()
Overrides
AbstractMoney.getCurrency()

Returns

the currency string.

getValue() Method

public double getValue()
Overrides
AbstractMoney.getValue()

Returns

the amount of money

set(double, String) Method

public MutableMoney set(double value, 
                        String currency)
Sets the value and currency of the object specified by the given parameters.

Parameters

value
the amount of money
currency
the string value of the currency

set(Money, double) Method

public MutableMoney set(Money money, 
                        double value)
Sets the value and currency of the object specified by the given parameters.

Parameters

money
the amount of money
value
the string value of the currency

set(Money) Method

public MutableMoney set(Money money)
Sets this object based on the values of the specified Money object.

Parameters

money
a money object

Returns

void

Related Topics

Money


setCurrency(String) Method

public void setCurrency(String currency)
Set the currency for this money object

Parameters

currency
currency to be added

setValue(double) Method

public void setValue(double value)
Set the amount for this money object

Parameters

value
amount of money

toString() Method

public String toString()
Returns the class of the object and the value and currency of the object.

Overrides
AbstractMoney.toString()

Returns

the value and currency of the object as a String