Module java.money

Class CurrencyConversionException

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 Details

    • CurrencyConversionException

      public CurrencyConversionException​(CurrencyUnit base, CurrencyUnit term, ConversionContext conversionContext, java.lang.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, 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 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.)
      conversionContext - the ConversionContext in place.
  • 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 java.lang.String toString()
      Overrides:
      toString in class java.lang.Throwable