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 anCurrencyConversionExceptionwith the specified source and target currency.CurrencyConversionException(CurrencyUnit base, CurrencyUnit term, ConversionContext conversionContext, java.lang.String message)Constructs anCurrencyConversionExceptionwith 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 CurrencyUnitgetBaseCurrency()Gets the first currency at fault.ConversionContextgetConversionContext()Gets the queried timestamp at fault.CurrencyUnitgetTermCurrency()Gets the second currency at fault.java.lang.StringtoString()
-
Constructor Details
-
CurrencyConversionException
public CurrencyConversionException(CurrencyUnit base, CurrencyUnit term, ConversionContext conversionContext, java.lang.String message)Constructs anCurrencyConversionExceptionwith 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- theConversionContextin place.message- the detail message.
-
CurrencyConversionException
public CurrencyConversionException(CurrencyUnit base, CurrencyUnit term, ConversionContext conversionContext)Constructs anCurrencyConversionExceptionwith the specified source and target currency.- Parameters:
base- the source currency, may be null.term- the target currency, may be null.conversionContext- theConversionContextin 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
causeis 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). (Anullvalue is permitted, and indicates that the cause is nonexistent or unknown.)conversionContext- theConversionContextin 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:
toStringin classjava.lang.Throwable
-