Module java.money

Class ConversionQuery

All Implemented Interfaces:
Serializable, CurrencySupplier

public final class ConversionQuery extends AbstractQuery implements CurrencySupplier
Query for accessing CurrencyConversion instances. If not properties are set the query should returns the default currencies.

This class is immutable, serializable and thread-safe.

See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      serialVersionUID.
      See Also:
    • KEY_BASE_CURRENCY

      static final String KEY_BASE_CURRENCY
      THe key used for the base currency attribute.
      See Also:
    • KEY_TERM_CURRENCY

      static final String KEY_TERM_CURRENCY
      THe key used for the term currency attribute.
      See Also:
    • KEY_RATE_TYPES

      static final String KEY_RATE_TYPES
      THe key used for the rate types attribute.
      See Also:
  • Constructor Details

    • ConversionQuery

      ConversionQuery(ConversionQueryBuilder builder)
      Constructor, used from the ConversionQueryBuilder.
      Parameters:
      builder - the corresponding builder, not null.
  • Method Details

    • getRateTypes

      public Set<RateType> getRateTypes()
      Get the rate types set.
      Returns:
      the rate types set, or an empty array, but never null.
    • getBaseCurrency

      public CurrencyUnit getBaseCurrency()
      Get the base currency. This attribute is optional, when a CurrencyConversion is accessed. It is optional if accessing instances of ExchangeRateProvider. If set it can constraint a CurrencyConversion or ExchangeRateProvider to only support one type of base currency. By default it is not set, hereby determining the base currency by the amount onto which the conversion is applied.
      Returns:
      the base CurrencyUnit, or null.
    • getCurrency

      public CurrencyUnit getCurrency()
      Get the terminating currency. This attribute is required, when a CurrencyConversion is accessed. It is optional if accessing instances of ExchangeRateProvider.
      Specified by:
      getCurrency in interface CurrencySupplier
      Returns:
      the terminating CurrencyUnit, or null.
    • toBuilder

      public ConversionQueryBuilder toBuilder()
      Creates a new Builder preinitialized with values from this instance.
      Returns:
      a new Builder, never null.