java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
javax.money.MonetaryException
javax.money.convert.CurrencyConversionException
- All Implemented Interfaces:
java.io.Serializable
public class CurrencyConversionException extends MonetaryException
Exception thrown when a monetary conversion operation fails.
- Author:
- Werner Keil, Stephen Colebourne, Anatole Tresch
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description CurrencyConversionException(CurrencyUnit base, CurrencyUnit term, ConversionContext conversionContext)
Constructs anCurrencyConversionException
with the specified source and target currency.CurrencyConversionException(CurrencyUnit base, CurrencyUnit term, ConversionContext conversionContext, java.lang.String message)
Constructs anCurrencyConversionException
with the specified detail message, timestamp, source and target currency.CurrencyConversionException(CurrencyUnit base, CurrencyUnit term, ConversionContext conversionContext, java.lang.String message, java.lang.Throwable cause)
Constructs a new exception with the specified source and target currency, detail message and cause. -
Method Summary
Modifier and Type Method Description CurrencyUnit
getBaseCurrency()
Gets the first currency at fault.ConversionContext
getConversionContext()
Gets the queried timestamp at fault.CurrencyUnit
getTermCurrency()
Gets the second currency at fault.java.lang.String
toString()
-
Constructor Details
-
CurrencyConversionException
public CurrencyConversionException(CurrencyUnit base, CurrencyUnit term, ConversionContext conversionContext, java.lang.String message)Constructs anCurrencyConversionException
with the specified detail message, timestamp, source and target currency.- Parameters:
base
- the source currency, may be null.term
- the target currency, may be null.conversionContext
- theConversionContext
in place.message
- the detail message.
-
CurrencyConversionException
public CurrencyConversionException(CurrencyUnit base, CurrencyUnit term, ConversionContext conversionContext)Constructs anCurrencyConversionException
with the specified source and target currency.- Parameters:
base
- the source currency, may be null.term
- the target currency, may be null.conversionContext
- theConversionContext
in place.
-
CurrencyConversionException
public CurrencyConversionException(CurrencyUnit base, CurrencyUnit term, ConversionContext conversionContext, java.lang.String message, java.lang.Throwable cause)Constructs a new exception with the specified source and target currency, detail message and cause.Note that the detail message associated with
cause
is not automatically incorporated in this exception's detail message.- Parameters:
base
- the source currency, may be null.term
- the target currency, may be null.message
- the detail message (which is saved for later retrieval by theThrowable.getMessage()
method).cause
- the cause (which is saved for later retrieval by theThrowable.getCause()
method). (Anull
value is permitted, and indicates that the cause is nonexistent or unknown.)conversionContext
- theConversionContext
in place.
-
-
Method Details
-
getBaseCurrency
Gets the first currency at fault.- Returns:
- the currency at fault, may be null
-
getTermCurrency
Gets the second currency at fault.- Returns:
- the currency at fault, may be null
-
getConversionContext
Gets the queried timestamp at fault.- Returns:
- the queried timestamp, or
null
.
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Throwable
-