## Interface FxConvertible<R>

• Type Parameters:
R - the result type expressed in a single currency
All Known Subinterfaces:
LegAmount, PointSensitivity
All Known Implementing Classes:
BondFutureOptionSensitivity, CashFlow, CashFlows, CreditCurveZeroRateSensitivity, CrossGammaParameterSensitivities, CrossGammaParameterSensitivity, CurrencyAmount, CurrencyAmountArray, CurrencyParameterSensitivities, CurrencyParameterSensitivity, CurveSensitivities, FxForwardSensitivity, FxIndexSensitivity, FxOptionSensitivity, IborCapletFloorletSabrSensitivity, IborCapletFloorletSensitivity, IborFutureOptionSensitivity, IborRateSensitivity, InflationRateSensitivity, IssuerCurveZeroRateSensitivity, JumpToDefault, LegAmounts, Money, MultiCurrencyAmount, MultiCurrencyAmountArray, OvernightRateSensitivity, Payment, PointSensitivities, RepoCurveZeroRateSensitivity, SwapLegAmount, SwaptionSabrSensitivity, SwaptionSensitivity, ZeroRateSensitivity

public interface FxConvertible<R>
Defines a standard mechanism for converting an object representing one or more monetary amounts to a single currency.

The single method allows a monetary object to be converted to a similar object expressed in terms of the specified currency. The conversion is permitted to return a different type.

For example, the MultiCurrencyAmount class implements this interface and returns a CurrencyAmount instance.

Implementations do not have to be immutable, but calls to the method must be thread-safe.

• ### Method Summary

All Methods
Modifier and Type Method Description
R convertedTo​(Currency resultCurrency, FxRateProvider rateProvider)
Converts this instance to an equivalent amount in the specified currency.
• ### Method Detail

• #### convertedTo

R convertedTo​(Currency resultCurrency,
FxRateProvider rateProvider)
Converts this instance to an equivalent amount in the specified currency.

The result, which may be of a different type, will be expressed in terms of the given currency. Any FX conversion that is required will use rates from the provider.

Parameters:
resultCurrency - the currency of the result
rateProvider - the provider of FX rates
Returns:
the converted instance, which should be expressed in the specified currency
Throws:
java.lang.RuntimeException - if no FX rate could be found