/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(FixedRateCalculation beanToCopy) { this.dayCount = beanToCopy.getDayCount(); this.rate = beanToCopy.getRate(); this.initialStub = beanToCopy.initialStub; this.finalStub = beanToCopy.finalStub; this.futureValueNotional = beanToCopy.futureValueNotional; }
@Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 1905311443: // dayCount return ((FixedRateCalculation) bean).getDayCount(); case 3493088: // rate return ((FixedRateCalculation) bean).getRate(); case 1233359378: // initialStub return ((FixedRateCalculation) bean).initialStub; case 355242820: // finalStub return ((FixedRateCalculation) bean).finalStub; case -282775858: // futureValueNotional return ((FixedRateCalculation) bean).futureValueNotional; } return super.propertyGet(bean, propertyName, quiet); }
public void test_of() { FixedRateCalculation test = FixedRateCalculation.of(0.025d, ACT_365F); assertEquals(test.getType(), SwapLegType.FIXED); assertEquals(test.getRate(), ValueSchedule.of(0.025d)); assertEquals(test.getDayCount(), ACT_365F); assertEquals(test.getInitialStub(), Optional.empty()); assertEquals(test.getFinalStub(), Optional.empty()); assertEquals(test.getFutureValueNotional(), Optional.empty()); }
public void test_builder() { FixedRateCalculation test = FixedRateCalculation.builder() .dayCount(ACT_365F) .rate(ValueSchedule.of(0.025d)) .initialStub(FixedRateStubCalculation.ofFixedRate(0.1d)) .finalStub(FixedRateStubCalculation.ofFixedRate(0.2d)) .futureValueNotional(FutureValueNotional.autoCalculate()) .build(); assertEquals(test.getRate(), ValueSchedule.of(0.025d)); assertEquals(test.getDayCount(), ACT_365F); assertEquals(test.getInitialStub(), Optional.of(FixedRateStubCalculation.ofFixedRate(0.1d))); assertEquals(test.getFinalStub(), Optional.of(FixedRateStubCalculation.ofFixedRate(0.2d))); assertEquals(test.getFutureValueNotional(), Optional.of(FutureValueNotional.autoCalculate())); }