@Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 111972721: // value return ((MoneynessStrike) bean).getValue(); } return super.propertyGet(bean, propertyName, quiet); }
@Override public MoneynessStrike build() { return new MoneynessStrike( value); }
public void test_ofStrikeAndForward() { MoneynessStrike test = MoneynessStrike.ofStrikeAndForward(0.6d, 1.2d); assertEquals(test.getType(), StrikeType.MONEYNESS); assertEquals(test.getValue(), 0.5d, 0d); assertEquals(test.getLabel(), "Moneyness=0.5"); assertEquals(test.withValue(0.2d), MoneynessStrike.of(0.2d)); }
/** * Obtains an instance of {@code Moneyness} from the strike and forward. * <p> * The moneyness is defined as {@code strike/forward}. * * @param strike the strike, not negative * @param forward the forward, not negative * @return the instance */ public static MoneynessStrike ofStrikeAndForward(double strike, double forward) { return of(ArgChecker.notNegativeOrZero(strike, "strike") / ArgChecker.notNegative(forward, "forward")); }
public void test_serialization() { MoneynessStrike test = MoneynessStrike.of(0.6d); assertSerialization(test); }
/** * Obtains an instance of {@code Moneyness} with the value of moneyness. * * @param moneyness the value of moneyness, not negative * @return the instance */ public static MoneynessStrike of(double moneyness) { return new MoneynessStrike(moneyness); }
public void coverage() { GenericVolatilitySurfaceYearFractionParameterMetadata test1 = GenericVolatilitySurfaceYearFractionParameterMetadata.of(TIME_TO_EXPIRY, STRIKE1); coverImmutableBean(test1); GenericVolatilitySurfaceYearFractionParameterMetadata test2 = GenericVolatilitySurfaceYearFractionParameterMetadata.of(3d, MoneynessStrike.of(1.1d)); coverBeanEquals(test1, test2); }
@Override public MoneynessStrike withValue(double value) { return new MoneynessStrike(value); }
public void coverage() { FxVolatilitySurfaceYearFractionParameterMetadata test1 = FxVolatilitySurfaceYearFractionParameterMetadata.of(TIME_TO_EXPIRY, STRIKE, CURRENCY_PAIR); coverImmutableBean(test1); FxVolatilitySurfaceYearFractionParameterMetadata test2 = FxVolatilitySurfaceYearFractionParameterMetadata.of(3d, MoneynessStrike.of(1.1d), CurrencyPair.of(EUR, AUD)); coverBeanEquals(test1, test2); }
public void coverage() { GenericVolatilitySurfacePeriodParameterMetadata test1 = GenericVolatilitySurfacePeriodParameterMetadata.of(TIME_TO_EXPIRY, STRIKE1); coverImmutableBean(test1); GenericVolatilitySurfacePeriodParameterMetadata test2 = GenericVolatilitySurfacePeriodParameterMetadata.of(Period.ofMonths(3), MoneynessStrike.of(1.1d)); coverBeanEquals(test1, test2); }