public final class ExchangeRate extends Object
Exchange rates for each currency pair can be maintained by using either a direct or an indirect quotation. A direct quotation is where the exchange rate value is defined as the cost of one unit of 'fromCurrency' in units of 'toCurrency', whereas an indirect quotation is where the exchange rate value is defined as the cost of one unit of 'toCurrency' in units of 'fromCurrency'.
For example,if your 'fromCurrency' is USD and the 'toCurrency' is EUR, then a sample exchange rate value will look as follows: Direct exchange rate: 1 USD = 0.92819 EUR. Indirect exchange rate: 1 EUR = 1.08238 USD.
Exchange rates in the ExchangeRateValue
for each currency pair can also be expressed by using
'fromCurrencyfactor' and 'toCurrencyfactor'.
For example, if your 'fromCurrency' is USD and 'toCurrency' is EUR, then a sample exchange rate with factors can be
defined as follows: With both 'fromCurrencyfactor' and 'toCurrencyfactor' as 1: 1 USD = 0.92819 EUR where 0.92819 is
the ExchangeRateValue
. With 'fromCurrencyfactor' as 100 and 'toCurrencyfactor' as 1: 100 USD = 92.819 EUR
where 92.819 is the ExchangeRateValue
. With 'fromCurrencyfactor' as 1 and 'toCurrencyfactor' as 100: 0.01 USD
= 0.0092819 EUR where 0.0092819 is the ExchangeRateValue
.
The parameters are as follows:
tenantIdentifier - The Tenant
identifier for which the conversion is requested.
ratesDataProviderCode - The RatesDataProviderCode
.
ratesDataSource - The RatesDataSource
.
exchangeRateType - The RateType
.
exchangeRateValue - The ExchangeRateValue
.
fromCurrency - The source Currency
.
toCurrency - The target Currency
.
validFromDateTime - The date time from which the exchange rate is valid.
isIndirect - An indicator to distinguish between the exchange rate maintained in direct or indirect quotations. The default value is false, which indicates a direct quotation.
fromCurrencyfactor - The CurrencyFactor
specifies the number of currency units for the source currency which
is the 'fromCurrency'.
toCurrencyfactor - The CurrencyFactor
specifies the number of currency units for the target currency which is
'toCurrency'.
Modifier and Type | Class and Description |
---|---|
static class |
ExchangeRate.ExchangeRateBuilder
A builder to default the value of 'fromCurrencyfactor' and 'toCurrencyfactor' to 1 and the value of 'isIndirect'
to 'false' if you provide a null value or no value.
|
Modifier and Type | Method and Description |
---|---|
static ExchangeRate.ExchangeRateBuilder |
builder() |
boolean |
equals(Object o) |
@NonNull RateType |
getExchangeRateType() |
@NonNull ExchangeRateValue |
getExchangeRateValue() |
@NonNull Currency |
getFromCurrency() |
CurrencyFactor |
getFromCurrencyfactor() |
Boolean |
getIsIndirect() |
RatesDataProviderCode |
getRatesDataProviderCode() |
RatesDataSource |
getRatesDataSource() |
Tenant |
getTenantIdentifier() |
@NonNull Currency |
getToCurrency() |
CurrencyFactor |
getToCurrencyfactor() |
@NonNull Instant |
getValidFromDateTime() |
int |
hashCode() |
String |
toString() |
@Nonnull public static ExchangeRate.ExchangeRateBuilder builder()
@Nullable public RatesDataProviderCode getRatesDataProviderCode()
@Nullable public RatesDataSource getRatesDataSource()
@NonNull public @NonNull RateType getExchangeRateType()
@NonNull public @NonNull ExchangeRateValue getExchangeRateValue()
@NonNull public @NonNull Currency getFromCurrency()
@NonNull public @NonNull Currency getToCurrency()
@NonNull public @NonNull Instant getValidFromDateTime()
public Boolean getIsIndirect()
public CurrencyFactor getFromCurrencyfactor()
public CurrencyFactor getToCurrencyfactor()
Copyright © 2021 SAP SE. All rights reserved.