- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- java.lang.IllegalArgumentException
-
- org.joda.money.CurrencyMismatchException
-
- All Implemented Interfaces:
Serializable
public class CurrencyMismatchException extends IllegalArgumentException
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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CurrencyMismatchException(CurrencyUnit firstCurrency, CurrencyUnit secondCurrency)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CurrencyUnit
getFirstCurrency()
Gets the first currency at fault.CurrencyUnit
getSecondCurrency()
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
-
-
-
-
Constructor Detail
-
CurrencyMismatchException
public CurrencyMismatchException(CurrencyUnit firstCurrency, CurrencyUnit secondCurrency)
Constructor.- Parameters:
firstCurrency
- the first currency, may be nullsecondCurrency
- the second currency, not null
-
-
Method Detail
-
getFirstCurrency
public CurrencyUnit getFirstCurrency()
Gets the first currency at fault.- Returns:
- the currency at fault, may be null
-
getSecondCurrency
public CurrencyUnit getSecondCurrency()
Gets the second currency at fault.- Returns:
- the currency at fault, may be null
-
-