class DiscountingCmsPeriodPricer {

  public double forwardRate(
      CmsPeriod cmsPeriod,
      RatesProvider provider) {

    LocalDate fixingDate = cmsPeriod.getFixingDate();
    LocalDate valuationDate = provider.getValuationDate();
    if (!fixingDate.isAfter(valuationDate)) { // Using fixing
      throw new IllegalArgumentException("Forward rate is availaible only for valuation date after the fixing date");
    }
    ResolvedSwap swap = cmsPeriod.getUnderlyingSwap();
    return swapPricer.parRate(swap, provider);
  }

  public  DiscountingCmsPeriodPricer(
      DiscountingSwapProductPricer swapPricer);

}