calcEl.findChild("futureValueNotional").ifPresent(fvnEl -> { FutureValueNotional notional = FutureValueNotional.builder() .value(document.parseDecimal(fvnEl.getChild("amount"))) .dayCountDays(fvnEl.findChild("calculationPeriodNumberOfDays") .map(str -> (int) document.parseDecimal(str)) .orElse(null)) .valueDate(fvnEl.findChild("valueDate").map(str -> document.parseDate(str)).orElse(null)) .build(); fixedRateBuilder.futureValueNotional(notional); });
public void test_builder() { FutureValueNotional test1 = FutureValueNotional.builder() .value(VALUE) .valueDate(VAL_DATE) .dayCountDays(NUM_DAYS) .build(); assertEquals(test1.getValue(), OptionalDouble.of(VALUE)); assertEquals(test1.getDayCountDays(), OptionalInt.of(NUM_DAYS)); assertEquals(test1.getValueDate(), Optional.of(VAL_DATE)); FutureValueNotional test2 = FutureValueNotional.builder() .value(VALUE) .build(); assertEquals(test2.getValue(), OptionalDouble.of(VALUE)); assertEquals(test2.getDayCountDays(), OptionalInt.empty()); assertEquals(test2.getValueDate(), Optional.empty()); }
public void coverage() { FutureValueNotional futureValueNotionalOne = FutureValueNotional.builder() .value(1001d) .dayCountDays(30) .valueDate(LocalDate.of(2016, 6, 6)) .build(); coverImmutableBean(futureValueNotionalOne); FutureValueNotional futureValueNotionalTwo = FutureValueNotional.builder() .value(2001d) .dayCountDays(60) .valueDate(LocalDate.of(2017, 6, 6)) .build(); coverBeanEquals(futureValueNotionalOne, futureValueNotionalTwo); }
@Override public FutureValueNotional.Builder builder() { return new FutureValueNotional.Builder(); }
/** * Returns a builder used to create an instance of the bean. * @return the builder, not null */ public static FutureValueNotional.Builder builder() { return new FutureValueNotional.Builder(); }
/** * Returns a builder that allows this bean to be mutated. * @return the mutable builder, not null */ public Builder toBuilder() { return new Builder(this); }