- java.lang.Object
-
- javax.money.AbstractContext
-
- javax.money.AbstractQuery
-
- javax.money.convert.ConversionQuery
-
- All Implemented Interfaces:
java.io.Serializable,CurrencySupplier
public final class ConversionQuery extends AbstractQuery implements CurrencySupplier
Query for accessingCurrencyConversioninstances. If not properties are set the query should returns the default currencies.This class is immutable, serializable and thread-safe.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.StringKEY_BASE_CURRENCYTHe key used for the base currency attribute.(package private) static java.lang.StringKEY_RATE_TYPESTHe key used for the rate types attribute.(package private) static java.lang.StringKEY_TERM_CURRENCYTHe key used for the term currency attribute.private static longserialVersionUIDserialVersionUID.-
Fields inherited from class javax.money.AbstractQuery
KEY_QUERY_PROVIDERS, KEY_QUERY_TARGET_TYPE, KEY_QUERY_TIMESTAMP
-
Fields inherited from class javax.money.AbstractContext
KEY_PROVIDER
-
-
Constructor Summary
Constructors Constructor Description ConversionQuery(ConversionQueryBuilder builder)Constructor, used from the ConversionQueryBuilder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CurrencyUnitgetBaseCurrency()Get the base currency.CurrencyUnitgetCurrency()Get the terminating currency.java.util.Set<RateType>getRateTypes()Get the rate types set.ConversionQueryBuildertoBuilder()Creates a new Builder preinitialized with values from this instance.-
Methods inherited from class javax.money.AbstractQuery
getProviderNames, getTargetType
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
serialVersionUID.- See Also:
- Constant Field Values
-
KEY_BASE_CURRENCY
static final java.lang.String KEY_BASE_CURRENCY
THe key used for the base currency attribute.- See Also:
- Constant Field Values
-
KEY_TERM_CURRENCY
static final java.lang.String KEY_TERM_CURRENCY
THe key used for the term currency attribute.- See Also:
- Constant Field Values
-
KEY_RATE_TYPES
static final java.lang.String KEY_RATE_TYPES
THe key used for the rate types attribute.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ConversionQuery
ConversionQuery(ConversionQueryBuilder builder)
Constructor, used from the ConversionQueryBuilder.- Parameters:
builder- the corresponding builder, not null.
-
-
Method Detail
-
getRateTypes
public java.util.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 aCurrencyConversionis accessed. It is optional if accessing instances ofExchangeRateProvider. If set it can constraint aCurrencyConversionorExchangeRateProviderto 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 aCurrencyConversionis accessed. It is optional if accessing instances ofExchangeRateProvider.- Specified by:
getCurrencyin interfaceCurrencySupplier- 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.
-
-