Top Description Fields Constructors Methods
org.javamoney.moneta.convert

public Class IdentityRateProvider

extends AbstractRateProvider
Class Inheritance
Imports
java.math.BigDecimal, javax.money.convert.ConversionQuery, .ExchangeRate, .ProviderContext, .ProviderContextBuilder, .RateType, org.javamoney.moneta.convert.ExchangeRateBuilder, org.javamoney.moneta.spi.AbstractRateProvider, .DefaultNumberValue

This class implements an javax.money.convert.ExchangeRateProvider that provides exchange rate with factor one for identical base/term currencies.
Authors
Anatole Tresch, Werner Keil

Field Summary

Modifier and TypeField and Description
private static final ProviderContext
Inherited from org.javamoney.moneta.spi.AbstractRateProvider:
log

Constructor Summary

AccessConstructor and Description
public
IdentityRateProvider()

Constructor, also loads initial data.

Method Summary

Modifier and TypeMethod and Description
public ExchangeRate
public ExchangeRate
getReversed(ExchangeRate rate)

Overrides default javax.money.convert.ExchangeRateProvider.getReversed.

The method reverses the ExchangeRate to a rate mapping from term to base CurrencyUnit.

public boolean

Returns:

true, if the contained base and term currencies are known to this provider.
isAvailable
(ConversionQuery
the required ConversionQuery, not null
conversionQuery
)

Overrides default javax.money.convert.ExchangeRateProvider.isAvailable.

Check if this provider can provide a rate, which is only the case if base and term are equal.

Inherited from org.javamoney.moneta.spi.AbstractRateProvider:
dividedividegetContextgetCurrencyConversiongetExchangeContextgetQueryDatesgetScalemultiply

Field Detail

CONTEXTback to summary
private static final ProviderContext CONTEXT

The javax.money.convert.ConversionContext of this provider.

Constructor Detail

IdentityRateProviderback to summary
public IdentityRateProvider()

Constructor, also loads initial data.

Method Detail

getExchangeRateback to summary
public ExchangeRate getExchangeRate(ConversionQuery conversionQuery)

Implements abstract org.javamoney.moneta.spi.AbstractRateProvider.getExchangeRate.

Implements javax.money.convert.ExchangeRateProvider.getExchangeRate.

Doc from javax.money.convert.ExchangeRateProvider.getExchangeRate.

Access a ExchangeRate using the given currencies. The ExchangeRate may be, depending on the data provider, real-time or deferred. This method should return the rate that is currently valid.

Annotations
@Override
getReversedback to summary
public ExchangeRate getReversed(ExchangeRate rate)

Overrides default javax.money.convert.ExchangeRateProvider.getReversed.

Doc from javax.money.convert.ExchangeRateProvider.getReversed.

The method reverses the ExchangeRate to a rate mapping from term to base CurrencyUnit. Hereby the factor must not be recalculated as 1/oldFactor, since typically reverse rates are not symmetric in most cases.

Annotations
@Override
isAvailableback to summary
public boolean isAvailable(ConversionQuery conversionQuery)

Overrides default javax.money.convert.ExchangeRateProvider.isAvailable.

Check if this provider can provide a rate, which is only the case if base and term are equal.

Parameters
conversionQuery:ConversionQuery

the required ConversionQuery, not null

Returns:boolean

true, if the contained base and term currencies are known to this provider.

Annotations
@Override