/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(InflationRateCalculation beanToCopy) { this.index = beanToCopy.getIndex(); this.lag = beanToCopy.getLag(); this.indexCalculationMethod = beanToCopy.getIndexCalculationMethod(); this.firstIndexValue = beanToCopy.firstIndexValue; this.gearing = beanToCopy.gearing; }
@Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 100346066: // index return ((InflationRateCalculation) bean).getIndex(); case 106898: // lag return ((InflationRateCalculation) bean).getLag(); case -1409010088: // indexCalculationMethod return ((InflationRateCalculation) bean).getIndexCalculationMethod(); case 922631823: // firstIndexValue return ((InflationRateCalculation) bean).firstIndexValue; case -91774989: // gearing return ((InflationRateCalculation) bean).gearing; } return super.propertyGet(bean, propertyName, quiet); }
public void test_of() { InflationRateCalculation test1 = InflationRateCalculation.of(CH_CPI, 3, MONTHLY); assertEquals(test1.getIndex(), CH_CPI); assertEquals(test1.getLag(), Period.ofMonths(3)); assertEquals(test1.getIndexCalculationMethod(), MONTHLY); assertEquals(test1.getFirstIndexValue(), OptionalDouble.empty()); assertEquals(test1.getGearing(), Optional.empty()); assertEquals(test1.getType(), SwapLegType.INFLATION); }
public void test_of_firstIndexValue() { InflationRateCalculation test1 = InflationRateCalculation.of(CH_CPI, 3, MONTHLY, 123d); assertEquals(test1.getIndex(), CH_CPI); assertEquals(test1.getLag(), Period.ofMonths(3)); assertEquals(test1.getIndexCalculationMethod(), MONTHLY); assertEquals(test1.getFirstIndexValue(), OptionalDouble.of(123d)); assertEquals(test1.getGearing(), Optional.empty()); assertEquals(test1.getType(), SwapLegType.INFLATION); }
public void test_builder() { InflationRateCalculation test1 = InflationRateCalculation.builder() .index(CH_CPI) .lag(Period.ofMonths(3)) .indexCalculationMethod(MONTHLY) .firstIndexValue(123d) .build(); assertEquals(test1.getIndex(), CH_CPI); assertEquals(test1.getLag(), Period.ofMonths(3)); assertEquals(test1.getIndexCalculationMethod(), MONTHLY); assertEquals(test1.getGearing(), Optional.empty()); assertEquals(test1.getFirstIndexValue(), OptionalDouble.of(123d)); assertEquals(test1.getType(), SwapLegType.INFLATION); InflationRateCalculation test2 = InflationRateCalculation.builder() .index(GB_HICP) .lag(Period.ofMonths(4)) .indexCalculationMethod(INTERPOLATED) .gearing(GEARING) .build(); assertEquals(test2.getIndex(), GB_HICP); assertEquals(test2.getLag(), Period.ofMonths(4)); assertEquals(test2.getIndexCalculationMethod(), INTERPOLATED); assertEquals(test2.getFirstIndexValue(), OptionalDouble.empty()); assertEquals(test2.getGearing().get(), GEARING); assertEquals(test2.getType(), SwapLegType.INFLATION); }