Gosu MonetaryAmount entity in PolicyCenter 8.0
New
in 8.0 is a Gosu MonetaryAmount
entity that encapsulates a money amount and a currency. To create a new
instance of the MonetaryAmount
object, pass a BigDecimal
amount and a Currency
code to the constructor, for example:
new MonetaryAmount(500, Currency.TC_AUD)It is possible to use MonetaryAmount objects with Gosu arithmetic operators. However, in any arithmetic operation, the currency types for MonetaryAmount objects must match. For example, the following operation throws an exception:
(500, USD) + (500, JPY)