History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: OQ-223
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Dick Anderson
Reporter: Dick Anderson
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OpenQuote

Make CurrencyAmount immutable

Created: 04/May/10 09:16 AM   Updated: 08/May/10 05:20 AM
Component/s: None
Affects Version/s: None
Fix Version/s: 1.3

Release Notes Comment:
The CurrencyAmount type is now immutable. This means that you now cannot change the amount or currency of an
instance; instead a new instance must be created. This brings CurrencyAmount into line with some of Java's
core types and makes it's use far safer. However, it also means that some of the old operations are no longer
supported, and some have been modified. The add(CurrencyAmount), subtract(CurrencyAmount) and apply(Rate)
methods have been altered so they no longer modify the instance they are invoked upon, but instead return new
instance.

Where you previously used would have done:

total.add(additionalAmount);

you would replace this with:

total=total.add(additionalAmount);

The same is true for the subtract() and apply() methods. The methods which modified the amount or currency
properties have been removed. Where you previously might have changed a CurrencyAmount's currency as follows:

total.setCurrency(Currency.GBP);

you would now replace this with:

total=new CurrancyAmount(total.getAmount(), Currency.GBP);


 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.