/** * Returns a builder that allows this bean to be mutated. * @return the mutable builder, not null */ public Builder toBuilder() { return new Builder(this); }
/** * Returns an instance containing the specified leg amounts. * * @param amounts the individual leg amounts * @return an instance containing the specified leg amounts */ public static LegAmounts of(List<LegAmount> amounts) { return new LegAmounts(amounts); }
@Override public CashFlow build() { return new CashFlow( paymentDate, presentValue, forecastValue, discountFactor); }
/** * Obtains an instance from a swap leg and amount. * * @param leg the swap leg * @param amount the amount * @return the swap leg amount */ public static SwapLegAmount of(ResolvedSwapLeg leg, CurrencyAmount amount) { return builder() .amount(amount) .payReceive(leg.getPayReceive()) .type(leg.getType()) .currency(leg.getCurrency()) .build(); }
/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(SwapLegAmount beanToCopy) { this.amount = beanToCopy.getAmount(); this.payReceive = beanToCopy.getPayReceive(); this.type = beanToCopy.getType(); this.currency = beanToCopy.getCurrency(); }
public void test_cashFlow_provider() { CashFlow expected = CashFlow.ofForecastValue(PAYMENT_DATE, USD, NOTIONAL_USD, DF); assertEquals(PRICER.cashFlows(PAYMENT, PROVIDER), CashFlows.of(expected)); }
/** * Obtains an instance from a single cash flow. * * @param cashFlow The cash flow * @return the cash flows instance */ public static CashFlows of(CashFlow cashFlow) { return CashFlows.of(ImmutableList.of(cashFlow)); }
/** * Obtains an instance from a list of cash flows. * * @param cashFlows the list of cash flows * @return the cash flows instance */ public static CashFlows of(List<CashFlow> cashFlows) { return new CashFlows(cashFlows); }
@Override public SwapLegAmount build() { return new SwapLegAmount( amount, payReceive, type, currency); }
@Override public BeanBuilder<? extends CashFlows> builder() { return new CashFlows.Builder(); }
@Override public BeanBuilder<? extends LegAmounts> builder() { return new LegAmounts.Builder(); }
@Override public BeanBuilder<? extends CashFlow> builder() { return new CashFlow.Builder(); }
@Override protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) { metaProperty(propertyName); if (quiet) { return; } throw new UnsupportedOperationException("Property cannot be written: " + propertyName); }
/** * Returns a builder used to create an instance of the bean. * @return the builder, not null */ public static SwapLegAmount.Builder builder() { return new SwapLegAmount.Builder(); }
@Override public LegAmounts build() { return new LegAmounts( amounts); }
@Override public CashFlows build() { return new CashFlows( cashFlows); }
public void coverage() { LegAmounts test1 = LegAmounts.of(LEG_AMOUNT_1, LEG_AMOUNT_2); coverImmutableBean(test1); LegAmount swapLeg = SwapLegAmount.builder() .amount(CurrencyAmount.of(Currency.GBP, 1557.445)) .payReceive(PayReceive.PAY) .type(SwapLegType.FIXED) .currency(Currency.EUR) .build(); LegAmounts test2 = LegAmounts.of(swapLeg); coverBeanEquals(test1, test2); }
@Override public SwapLegAmount.Builder builder() { return new SwapLegAmount.Builder(); }