Top Description Fields Constructors Methods
javax.money.convert

public Class CurrencyConversionException

extends MonetaryException
Class Inheritance
Imports
javax.money.CurrencyUnit, .MonetaryException, java.util.Objects

Exception thrown when a monetary conversion operation fails.
Authors
Werner Keil, Stephen Colebourne, Anatole Tresch

Field Summary

Modifier and TypeField and Description
private final CurrencyUnit
base

Base currency.

private final ConversionContext
conversionContext

The acquired ConversionContext, may be null.

private static final long
private final CurrencyUnit
term

Terminating currency.

Constructor Summary

AccessConstructor and Description
public
CurrencyConversionException(CurrencyUnit
the source currency, may be null.
base
,
CurrencyUnit
the target currency, may be null.
term
,
ConversionContext conversionContext, String
the detail message.
message
)

Constructs an CurrencyConversionException with the specified detail message, timestamp, source and target currency.

public
CurrencyConversionException(CurrencyUnit
the source currency, may be null.
base
,
CurrencyUnit
the target currency, may be null.
term
,
ConversionContext conversionContext)

Constructs an CurrencyConversionException with the specified source and target currency.

public
CurrencyConversionException(CurrencyUnit
the source currency, may be null.
base
,
CurrencyUnit
the target currency, may be null.
term
,
ConversionContext conversionContext, String
the detail message (which is saved for later retrieval by the Throwable#getMessage() method).
message
,
Throwable
the cause (which is saved for later retrieval by the Throwable#getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
cause
)

Constructs a new exception with the specified source and target currency, detail message and cause.

Method Summary

Modifier and TypeMethod and Description
public CurrencyUnit

Returns:

the currency at fault, may be null
getBaseCurrency
()

Gets the first currency at fault.

public ConversionContext

Returns:

the queried timestamp, or null.
getConversionContext
()

Gets the queried timestamp at fault.

public CurrencyUnit

Returns:

the currency at fault, may be null
getTermCurrency
()

Gets the second currency at fault.

public String
toString()

Overrides java.lang.Throwable.toString.

Returns a short description of this throwable.

Field Detail

baseback to summary
private final CurrencyUnit base

Base currency.

conversionContextback to summary
private final ConversionContext conversionContext

The acquired ConversionContext, may be null.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides javax.money.MonetaryException.serialVersionUID.

Serialization lock.

termback to summary
private final CurrencyUnit term

Terminating currency.

Constructor Detail

CurrencyConversionExceptionback to summary
public CurrencyConversionException(CurrencyUnit base, CurrencyUnit term, ConversionContext conversionContext, String message)

Constructs an CurrencyConversionException with the specified detail message, timestamp, source and target currency.

Parameters
base:CurrencyUnit

the source currency, may be null.

term:CurrencyUnit

the target currency, may be null.

conversionContext:ConversionContext

the javax.money.convert.ConversionContext in place.

message:String

the detail message.

CurrencyConversionExceptionback to summary
public CurrencyConversionException(CurrencyUnit base, CurrencyUnit term, ConversionContext conversionContext)

Constructs an CurrencyConversionException with the specified source and target currency.

Parameters
base:CurrencyUnit

the source currency, may be null.

term:CurrencyUnit

the target currency, may be null.

conversionContext:ConversionContext

the javax.money.convert.ConversionContext in place.

CurrencyConversionExceptionback to summary
public CurrencyConversionException(CurrencyUnit base, CurrencyUnit term, ConversionContext conversionContext, String message, 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:CurrencyUnit

the source currency, may be null.

term:CurrencyUnit

the target currency, may be null.

conversionContext:ConversionContext

the javax.money.convert.ConversionContext in place.

message:String

the detail message (which is saved for later retrieval by the Throwable#getMessage() method).

cause:Throwable

the cause (which is saved for later retrieval by the Throwable#getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

Method Detail

getBaseCurrencyback to summary
public CurrencyUnit getBaseCurrency()

Gets the first currency at fault.

Returns:CurrencyUnit

the currency at fault, may be null

getConversionContextback to summary
public ConversionContext getConversionContext()

Gets the queried timestamp at fault.

Returns:ConversionContext

the queried timestamp, or null.

getTermCurrencyback to summary
public CurrencyUnit getTermCurrency()

Gets the second currency at fault.

Returns:CurrencyUnit

the currency at fault, may be null

toStringback to summary
public String toString()

Overrides java.lang.Throwable.toString.

Doc from java.lang.Throwable.toString.

Returns a short description of this throwable. The result is the concatenation of:

  • the name of the class of this object
  • ": " (a colon and a space)
  • the result of invoking this object's getLocalizedMessage method
If getLocalizedMessage returns null, then just the class name is returned.
Returns:String

a string representation of this throwable.

Annotations
@Override