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

public abstract Class AbstractRateProvider

extends Object
implements ExchangeRateProvider
Class Inheritance
All Implemented Interfaces
javax.money.convert.ExchangeRateProvider
Known Direct Subclasses
org.javamoney.moneta.spi.CompoundRateProvider
Static Imports
org.javamoney.moneta.spi.AbstractCurrencyConversion.KEY_SCALE

Abstract base class for ExchangeRateProvider implementations.
Authors
Anatole Tresch, Werner Keil

Field Summary

Modifier and TypeField and Description
private final ProviderContext
context

The ConversionContext of this provider.

protected final Logger
log

Deprecated

Constructor Summary

AccessConstructor and Description
public
AbstractRateProvider(ProviderContext
the ProviderContext, not null.
providerContext
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
protected static NumberValue

Returns:

the result of the division as NumberValue
divide
(NumberValue
the first value to be divided
dividend
,
NumberValue
the value to be divided by
divisor
)

A protected helper method to divide 2 NumberValue types.

protected static NumberValue

Returns:

the result of the division as NumberValue
divide
(NumberValue
the first value to be divided
dividend
,
NumberValue
the value to be divided by
divisor
,
MathContext
the MathContext to use
context
)

A protected helper method to divide 2 NumberValue types.

public ProviderContext
public CurrencyConversion
protected ConversionContext
public abstract ExchangeRate
getExchangeRate(ConversionQuery conversionQuery)

Redeclares javax.money.convert.ExchangeRateProvider.getExchangeRate.

Access a ExchangeRate using the given currencies.

protected LocalDate[]
protected int
protected static NumberValue

Returns:

the result of the multiplication as NumberValue
multiply
(NumberValue
the first value to be multiplied
multiplicand
,
NumberValue
the second value to be multiplied
multiplier
)

A protected helper method to multiply 2 NumberValue types.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextback to summary
private final ProviderContext context

The ConversionContext of this provider.

logback to summary
protected final Logger log

Deprecated

Annotations
@Deprecated

Constructor Detail

AbstractRateProviderback to summary
public AbstractRateProvider(ProviderContext providerContext)

Constructor.

Parameters
providerContext:ProviderContext

the ProviderContext, not null.

Method Detail

divideback to summary
protected static NumberValue divide(NumberValue dividend, NumberValue divisor)

A protected helper method to divide 2 NumberValue types.
If either of the values is null an ArithmeticException is thrown.

Parameters
dividend:NumberValue

the first value to be divided

divisor:NumberValue

the value to be divided by

Returns:NumberValue

the result of the division as NumberValue

divideback to summary
protected static NumberValue divide(NumberValue dividend, NumberValue divisor, MathContext context)

A protected helper method to divide 2 NumberValue types.
If either of the values is null an ArithmeticException is thrown.

Parameters
dividend:NumberValue

the first value to be divided

divisor:NumberValue

the value to be divided by

context:MathContext

the MathContext to use

Returns:NumberValue

the result of the division as NumberValue

getContextback to summary
public ProviderContext getContext()

Implements javax.money.convert.ExchangeRateProvider.getContext.

Doc from javax.money.convert.ExchangeRateProvider.getContext.

Access the ConversionContext for this ExchangeRateProvider. Each instance of ExchangeRateProvider provides conversion data for exact one ConversionContext .

Annotations
@Override
getCurrencyConversionback to summary
public CurrencyConversion getCurrencyConversion(ConversionQuery conversionQuery)

Implements javax.money.convert.ExchangeRateProvider.getCurrencyConversion.

Doc from javax.money.convert.ExchangeRateProvider.getCurrencyConversion.

Access a CurrencyConversion that can be applied as a MonetaryOperator to an amount.

Annotations
@Override
getExchangeContextback to summary
protected ConversionContext getExchangeContext(String key)
getExchangeRateback to summary
public abstract ExchangeRate getExchangeRate(ConversionQuery conversionQuery)

Redeclares 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
getQueryDatesback to summary
protected LocalDate[] getQueryDates(ConversionQuery query)
getScaleback to summary
protected int getScale(String key)
multiplyback to summary
protected static NumberValue multiply(NumberValue multiplicand, NumberValue multiplier)

A protected helper method to multiply 2 NumberValue types.
If either of the values is null an ArithmeticException is thrown.

Parameters
multiplicand:NumberValue

the first value to be multiplied

multiplier:NumberValue

the second value to be multiplied

Returns:NumberValue

the result of the multiplication as NumberValue