// Extract the underlying CDS from the CDS Swaption contract
CreditDefaultSwapDefinition modifiedCDS = getUnderlyingCDS();
// Modify the recovery rate of the underlying CDS
modifiedCDS = modifiedCDS.withRecoveryRate(recoveryRate);
// Return the modified CDS Swaption contract
return new CreditDefaultSwapOptionDefinition(
getBuySellProtection(),
getProtectionBuyer(),