@@ -0,0 +1,2757 @@
+/**%0A * Copyright (C) 2014 - present by OpenGamma Inc. and the OpenGamma group of companies%0A *%0A * Please see distribution for license.%0A */%0Apackage com.opengamma.financial.analytics.model.black;%0A%0Aimport java.util.Collections;%0Aimport java.util.Set;%0A%0Aimport com.opengamma.engine.ComputationTarget;%0Aimport com.opengamma.engine.function.FunctionCompilationContext;%0Aimport com.opengamma.engine.value.ValuePropertyNames;%0Aimport com.opengamma.engine.value.ValueRequirement;%0Aimport com.opengamma.engine.value.ValueRequirementNames;%0Aimport com.opengamma.financial.analytics.OpenGammaFunctionExclusions;%0Aimport com.opengamma.financial.analytics.model.volatility.SmileFittingPropertyNamesAndValues;%0Aimport com.opengamma.financial.property.DefaultPropertyFunction;%0Aimport com.opengamma.financial.security.FinancialSecurityTypes;%0Aimport com.opengamma.financial.security.option.SwaptionSecurity;%0A%0A/**%0A * Provides %22Surface%22 (DEFAULT) and %22VolatilityModel%22 (Black)%0A * TODO - Remove or refactor this Function. Created for purpose of demonstration.%0A */%0Apublic class BlackDiscountingSwaptionFunctionDefaults extends DefaultPropertyFunction %7B%0A%0A  /** The value requirement names that the function applies to */%0A  private static final String%5B%5D VALUE_REQUIREMENTS = new String%5B%5D %7B%0A    ValueRequirementNames.PRESENT_VALUE,%0A    ValueRequirementNames.VALUE_VEGA,%0A    ValueRequirementNames.PV01,%0A    ValueRequirementNames.YIELD_CURVE_NODE_SENSITIVITIES,%0A    ValueRequirementNames.SECURITY_IMPLIED_VOLATILITY,%0A    ValueRequirementNames.BUCKETED_PV01%0A  %7D;%0A  %0A  public BlackDiscountingSwaptionFunctionDefaults() %7B%0A    super(FinancialSecurityTypes.SWAPTION_SECURITY, true);%0A  %7D%0A%0A  @Override%0A  public boolean canApplyTo(final FunctionCompilationContext context, final ComputationTarget target) %7B%0A    return target.getTrade().getSecurity() instanceof SwaptionSecurity;%0A  %7D%0A  %0A  @Override%0A  protected void getDefaults(PropertyDefaults defaults) %7B%0A    for (final String valueRequirement : VALUE_REQUIREMENTS) %7B%0A      defaults.addValuePropertyName(valueRequirement, ValuePropertyNames.SURFACE);%0A      defaults.addValuePropertyName(valueRequirement, SmileFittingPropertyNamesAndValues.PROPERTY_VOLATILITY_MODEL);%0A    %7D%0A  %7D%0A%0A  @Override%0A  protected Set%3CString%3E getDefaultValue(FunctionCompilationContext context, ComputationTarget target, ValueRequirement desiredValue, String propertyName) %7B%0A    if (ValuePropertyNames.SURFACE.equals(propertyName)) %7B%0A      return Collections.singleton(%22DEFAULT%22);%0A    %7D%0A    if (SmileFittingPropertyNamesAndValues.PROPERTY_VOLATILITY_MODEL.equals(propertyName)) %7B%0A      return Collections.singleton(%22Black%22);%0A    %7D%0A    return null;%0A  %7D%0A%0A  @Override%0A  public String getMutualExclusionGroup() %7B%0A    return OpenGammaFunctionExclusions.SWAPTION_BLACK_DEFAULTS;%0A  %7D%0A%7D%0A

Create BlackDiscountingSwaptionFunctionDefaults