Issue Details (XML | Word | Printable)

Key: JAVAMONEY-25
Type: New Feature New Feature
Status: Closed Closed
Resolution: Won't Fix
Priority: Minor Minor
Assignee: atsticks
Reporter: atsticks
Votes: 0
Watchers: 0
Operations

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

Multi MonetaryAmount and CurrencyUnit Values

Created: 02/Feb/13 08:23 AM   Updated: 11/Mar/14 08:38 PM   Resolved: 11/Mar/14 08:38 PM
Component/s: Impl: RI
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Tags: MonetaryAmount compount_amount multi-value multi-currency
Participants: atsticks, chrispheby and keilw


 Description  « Hide

Define a compound multi-valued monetary amount that consists of several amounts:

  • of the same currency, but with different semantics, e.g. for use cases in insurance calculations
  • of different currencies, e.g. for easily switching between currencies supported in web shop
  • a mix of the above.

A compound value has the following properties:

  • it is immutable.
  • it does not offer arithemtics
  • it provides access to all its containing{{MonetaryAmount}} instances:
    • Map<String,MonetaryAmount> getAll()
    • Enumeration<String> getKeys();
    • MonetaryAmount getMonetaryAmount(String key)
    • boolean isMonetaryAmountDefined(String key)
  • It allows access to all different currencies contained:
    • Enumeration<CurrencyUnit> getContainedCurrencies()
  • it provides a CompoundMonetaryAmountFactory for creating compound values.
  • Since a compound amount is defined to be immutable, it can only be extended/adapted as follows:
    • CompoundMonetaryAmount add(String key, MonetaryAmount amount);
    • CompoundMonetaryAmount remove(String... key);
    • CompoundMonetaryAmountBuilder toBuilder() // and using the builder to create a new instance