@Override public PortfolioItemSummary summarize() { // Long 5Y USD 2mm Rec USD-LIBOR-6M / Pay 1% : 21Jan18 String swapDesc = product.getUnderlying().summaryDescription(); swapDesc = swapDesc.contains(":") ? swapDesc.substring(0, swapDesc.lastIndexOf(':')).trim() : swapDesc; StringBuilder buf = new StringBuilder(96); buf.append(product.getLongShort()); buf.append(' '); buf.append(swapDesc); buf.append(" : "); buf.append(SummarizerUtils.date(product.getExpiryDate().getUnadjusted())); return SummarizerUtils.summary(this, ProductType.SWAPTION, buf.toString(), product.getCurrency()); }
/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(Swaption beanToCopy) { this.longShort = beanToCopy.getLongShort(); this.swaptionSettlement = beanToCopy.getSwaptionSettlement(); this.expiryDate = beanToCopy.getExpiryDate(); this.expiryTime = beanToCopy.getExpiryTime(); this.expiryZone = beanToCopy.getExpiryZone(); this.underlying = beanToCopy.getUnderlying(); }
@Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 116685664: // longShort return ((Swaption) bean).getLongShort(); case -1937554512: // swaptionSettlement return ((Swaption) bean).getSwaptionSettlement(); case -816738431: // expiryDate return ((Swaption) bean).getExpiryDate(); case -816254304: // expiryTime return ((Swaption) bean).getExpiryTime(); case -816069761: // expiryZone return ((Swaption) bean).getExpiryZone(); case -1770633379: // underlying return ((Swaption) bean).getUnderlying(); } return super.propertyGet(bean, propertyName, quiet); }
public void test_builder() { Swaption test = sut(); assertEquals(test.getExpiryDate(), ADJUSTABLE_EXPIRY_DATE); assertEquals(test.getExpiryTime(), EXPIRY_TIME); assertEquals(test.getExpiryZone(), ZONE); assertEquals(test.getExpiry(), EXPIRY_DATE.atTime(EXPIRY_TIME).atZone(ZONE)); assertEquals(test.getLongShort(), LONG); assertEquals(test.getSwaptionSettlement(), PHYSICAL_SETTLE); assertEquals(test.getUnderlying(), SWAP); assertEquals(test.getCurrency(), USD); assertEquals(test.getIndex(), IborIndices.USD_LIBOR_3M); assertEquals(test.isCrossCurrency(), false); assertEquals(test.allPaymentCurrencies(), ImmutableSet.of(USD)); assertEquals(test.allCurrencies(), ImmutableSet.of(USD)); }