java.lang.Object
com.aoapps.lang.i18n.Monies
- All Implemented Interfaces:
Comparable<Monies>,Iterable<Money>
Stores multiple monetary values, with one value per currency.
- Author:
- AO Industries, Inc.
-
Method Summary
Modifier and TypeMethodDescriptionintbooleangetMap()inthashCode()booleanisEmpty()booleanisZero()Check if this is empty or all values are zero.iterator()multiply(BigDecimal multiplicand) Multiplies without rounding.multiply(BigDecimal multiplicand, RoundingMode roundingMode) Multiplies with rounding.negate()Returns with monetary amounts that are the negative of these amounts.static Moniesof()static Moniesstatic MoniesCombines all the provided the money, adding together any that have the same currency.static MoniesCombines all the provided the money, adding together any that have the same currency.Removes all currencies with a zero monetary value.intsize()toString()Displays as a comma-separated list ofMoney.toString()or""for an empty set.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
of
-
of
-
of
Combines all the provided the money, adding together any that have the same currency. -
of
Combines all the provided the money, adding together any that have the same currency. -
equals
-
hashCode
public int hashCode() -
compareTo
Compares twoMoniesby comparing each value matched byCurrency. During comparison, any currency not set is handled as zero.Two
Moniesare not comparable when they have a conflict where one currency is higher and a different currency is lower.- Specified by:
compareToin interfaceComparable<Monies>
-
iterator
-
get
-
getMap
-
isEmpty
public boolean isEmpty() -
size
public int size() -
getCurrencies
-
getValues
-
toString
Displays as a comma-separated list ofMoney.toString()or""for an empty set. -
add
- Throws:
ArithmeticException- See Also:
-
add
- Throws:
ArithmeticException- See Also:
-
multiply
Multiplies without rounding.- Throws:
ArithmeticException- See Also:
-
multiply
public Monies multiply(BigDecimal multiplicand, RoundingMode roundingMode) throws ArithmeticException Multiplies with rounding.- Throws:
ArithmeticException- See Also:
-
negate
Returns with monetary amounts that are the negative of these amounts.- See Also:
-
subtract
- Throws:
ArithmeticException- See Also:
-
subtract
- Throws:
ArithmeticException- See Also:
-
isZero
public boolean isZero()Check if this is empty or all values are zero. -
removeZeros
Removes all currencies with a zero monetary value.
-
