Module java.money

Class CurrencyConversionException

All Implemented Interfaces:
Serializable

public class CurrencyConversionException extends MonetaryException
Exception thrown when a monetary conversion operation fails.
See Also:
  • Field Details

  • Constructor Details

    • CurrencyConversionException

      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 - the source currency, may be null.
      term - the target currency, may be null.
      conversionContext - the ConversionContext in place.
      message - the detail message.
    • CurrencyConversionException

      public CurrencyConversionException(CurrencyUnit base, CurrencyUnit term, ConversionContext conversionContext)
      Constructs an CurrencyConversionException with the specified source and target currency.
      Parameters:
      base - the source currency, may be null.
      term - the target currency, may be null.
      conversionContext - the ConversionContext in place.
    • CurrencyConversionException

      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 - the source currency, may be null.
      term - the target currency, may be null.
      conversionContext - the ConversionContext in place.
      message - the detail message (which is saved for later retrieval by the Throwable.getMessage() method).
      cause - 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 Details

    • 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 String toString()
      Overrides:
      toString in class Throwable