Interface FxConvertible<R>
-
- Type Parameters:
R- the result type expressed in a single currency
- All Known Subinterfaces:
LegAmount,PointSensitivity
- All Known Implementing Classes:
BigMoney,BondFutureOptionSensitivity,BondYieldSensitivity,CashFlow,CashFlows,CreditCurveZeroRateSensitivity,CrossGammaParameterSensitivities,CrossGammaParameterSensitivity,CurrencyAmount,CurrencyAmountArray,CurrencyParameterSensitivities,CurrencyParameterSensitivity,CurveSensitivities,ExplainMap,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
MultiCurrencyAmountclass implements this interface and returns aCurrencyAmountinstance.Implementations do not have to be immutable, but calls to the method must be thread-safe.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description RconvertedTo(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 resultrateProvider- the provider of FX rates- Returns:
- the converted instance, which should be expressed in the specified currency
- Throws:
RuntimeException- if no FX rate could be found
-
-