Package org.joda.money
Class CurrencyMismatchException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
java.lang.IllegalArgumentException
org.joda.money.CurrencyMismatchException
- All Implemented Interfaces:
Serializable
Exception thrown when a monetary operation fails due to mismatched currencies.
For example, this exception would be thrown when trying to add a monetary value in one currency to a monetary value in a different currency.
This exception makes no guarantees about immutability or thread-safety.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CurrencyUnit
First currency.private final CurrencyUnit
Second currency.private static final long
Serialization lock. -
Constructor Summary
ConstructorsConstructorDescriptionCurrencyMismatchException
(CurrencyUnit firstCurrency, CurrencyUnit secondCurrency) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionGets the first currency at fault.Gets the second currency at fault.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization lock.- See Also:
-
firstCurrency
First currency. -
secondCurrency
Second currency.
-
-
Constructor Details
-
CurrencyMismatchException
Constructor.- Parameters:
firstCurrency
- the first currency, may be nullsecondCurrency
- the second currency, not null
-
-
Method Details
-
getFirstCurrency
Gets the first currency at fault.- Returns:
- the currency at fault, may be null
-
getSecondCurrency
Gets the second currency at fault.- Returns:
- the currency at fault, may be null
-