@Override public ImmutableSwapIndex build() { return new ImmutableSwapIndex( name, active, fixingTime, fixingZone, template); }
/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(ImmutableSwapIndex beanToCopy) { this.name = beanToCopy.getName(); this.active = beanToCopy.isActive(); this.fixingTime = beanToCopy.getFixingTime(); this.fixingZone = beanToCopy.getFixingZone(); this.template = beanToCopy.getTemplate(); }
private static SwapIndex parseSwapIndex(CsvRow row) { String name = row.getField(NAME_FIELD); boolean active = Boolean.parseBoolean(row.getField(ACTIVE_FIELD)); FixedIborSwapConvention convention = FixedIborSwapConvention.of(row.getField(CONVENTION_FIELD)); Tenor tenor = Tenor.parse(row.getField(TENOR_FIELD)); LocalTime time = LocalTime.parse(row.getField(FIXING_TIME_FIELD), TIME_FORMAT); ZoneId zoneId = ZoneId.of(row.getField(FIXING_ZONE_FIELD)); // build result return ImmutableSwapIndex.builder() .name(name) .active(active) .fixingTime(time) .fixingZone(zoneId) .template(FixedIborSwapTemplate.of(tenor, convention)) .build(); }
/** * Returns the name of the index. * * @return the name of the index */ @Override public String toString() { return getName(); }
public void test_serialization() { SwapIndex index = ImmutableSwapIndex.builder() .name("FooIndex") .fixingTime(LocalTime.of(12, 30)) .fixingZone(ZoneId.of("Africa/Abidjan")) .template(FixedIborSwapTemplate.of(Tenor.TENOR_9M, FixedIborSwapConventions.CHF_FIXED_1Y_LIBOR_3M)) .build(); assertSerialization(index); }
@Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 3373707: // name return ((ImmutableSwapIndex) bean).getName(); case -1422950650: // active return ((ImmutableSwapIndex) bean).isActive(); case 1255686170: // fixingTime return ((ImmutableSwapIndex) bean).getFixingTime(); case 1255870713: // fixingZone return ((ImmutableSwapIndex) bean).getFixingZone(); case -1321546630: // template return ((ImmutableSwapIndex) bean).getTemplate(); } return super.propertyGet(bean, propertyName, quiet); }
public void coverage() { ImmutableSwapIndex index = ImmutableSwapIndex.builder() .name("FooIndex") .fixingTime(LocalTime.of(12, 30)) .fixingZone(ZoneId.of("Africa/Abidjan")) .template(FixedIborSwapTemplate.of(Tenor.TENOR_9M, FixedIborSwapConventions.CHF_FIXED_1Y_LIBOR_3M)) .build(); coverImmutableBean(index); coverPrivateConstructor(SwapIndices.class); }
/** * Obtains an instance from the specified name, time and template. * * @param name the index name * @param fixingTime the fixing time * @param fixingZone the time-zone of the fixing time * @param template the swap template * @return the index */ public static ImmutableSwapIndex of( String name, LocalTime fixingTime, ZoneId fixingZone, FixedIborSwapTemplate template) { return new ImmutableSwapIndex(name, true, fixingTime, fixingZone, template); }