- 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.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private CurrencyUnitbaseBase currency.private ConversionContextconversionContextThe acquiredConversionContext, may be null.private static longserialVersionUIDSerialization lock.private CurrencyUnittermTerminating currency.
-
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
All Methods Instance Methods Concrete Methods 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()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serialization lock.- See Also:
- Constant Field Values
-
base
private final CurrencyUnit base
Base currency.
-
term
private final CurrencyUnit term
Terminating currency.
-
conversionContext
private final ConversionContext conversionContext
The acquiredConversionContext, may be null.
-
-
Constructor Detail
-
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 Detail
-
getBaseCurrency
public CurrencyUnit getBaseCurrency()
Gets the first currency at fault.- Returns:
- the currency at fault, may be null
-
getTermCurrency
public CurrencyUnit getTermCurrency()
Gets the second currency at fault.- Returns:
- the currency at fault, may be null
-
getConversionContext
public ConversionContext getConversionContext()
Gets the queried timestamp at fault.- Returns:
- the queried timestamp, or
null.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Throwable
-
-