public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case 3373707:         // name
                    this.name_Renamed = (string)newValue;
                    break;

                case -391537158:         // fixedLeg
                    this.fixedLeg_Renamed = (FixedRateSwapLegConvention)newValue;
                    break;

                case -1177101272:         // floatingLeg
                    this.floatingLeg_Renamed = (InflationRateSwapLegConvention)newValue;
                    break;

                case 746995843:         // spotDateOffset
                    this.spotDateOffset_Renamed = (DaysAdjustment)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(ImmutableFixedInflationSwapConvention beanToCopy)
 {
     this.name_Renamed           = beanToCopy.Name;
     this.fixedLeg_Renamed       = beanToCopy.FixedLeg;
     this.floatingLeg_Renamed    = beanToCopy.FloatingLeg;
     this.spotDateOffset_Renamed = beanToCopy.SpotDateOffset;
 }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            InflationRateSwapLegConvention test = InflationRateSwapLegConvention.builder().index(GB_HICP).lag(LAG_3M).build();

            coverImmutableBean(test);
            InflationRateSwapLegConvention test2 = InflationRateSwapLegConvention.builder().index(GB_HICP).lag(LAG_4M).indexCalculationMethod(PriceIndexCalculationMethod.INTERPOLATED).notionalExchange(true).build();

            coverBeanEquals(test, test2);
        }
        public virtual void test_builderAllSpecified()
        {
            InflationRateSwapLegConvention test = InflationRateSwapLegConvention.builder().index(GB_HICP).lag(LAG_3M).indexCalculationMethod(PriceIndexCalculationMethod.INTERPOLATED).notionalExchange(true).build();

            assertEquals(test.Index, GB_HICP);
            assertEquals(test.Lag, LAG_3M);
            assertEquals(test.IndexCalculationMethod, PriceIndexCalculationMethod.INTERPOLATED);
            assertEquals(test.NotionalExchange, true);
            assertEquals(test.Currency, GBP);
        }
        public virtual void test_builder()
        {
            InflationRateSwapLegConvention test = InflationRateSwapLegConvention.builder().index(GB_HICP).lag(LAG_3M).build();

            assertEquals(test.Index, GB_HICP);
            assertEquals(test.Lag, LAG_3M);
            assertEquals(test.IndexCalculationMethod, MONTHLY);
            assertEquals(test.NotionalExchange, false);
            assertEquals(test.Currency, GBP);
        }
        //-------------------------------------------------------------------------
        public virtual void test_of()
        {
            InflationRateSwapLegConvention test = InflationRateSwapLegConvention.of(GB_HICP, LAG_3M, MONTHLY, BDA_MOD_FOLLOW);

            assertEquals(test.Index, GB_HICP);
            assertEquals(test.Lag, LAG_3M);
            assertEquals(test.IndexCalculationMethod, MONTHLY);
            assertEquals(test.NotionalExchange, false);
            assertEquals(test.Currency, GBP);
        }
        //-------------------------------------------------------------------------
        public virtual void test_toLeg()
        {
            InflationRateSwapLegConvention @base = InflationRateSwapLegConvention.of(GB_HICP, LAG_3M, MONTHLY, BDA_MOD_FOLLOW);
            LocalDate startDate         = LocalDate.of(2015, 5, 5);
            LocalDate endDate           = LocalDate.of(2020, 5, 5);
            RateCalculationSwapLeg test = @base.toLeg(startDate, endDate, PAY, NOTIONAL_2M);

            RateCalculationSwapLeg expected = RateCalculationSwapLeg.builder().payReceive(PAY).accrualSchedule(PeriodicSchedule.builder().frequency(Frequency.TERM).startDate(startDate).endDate(endDate).businessDayAdjustment(BDA_MOD_FOLLOW).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.TERM).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(NotionalSchedule.of(GBP, NOTIONAL_2M)).calculation(InflationRateCalculation.of(GB_HICP, 3, MONTHLY)).build();

            assertEquals(test, expected);
        }
 private ImmutableFixedInflationSwapConvention(string name, FixedRateSwapLegConvention fixedLeg, InflationRateSwapLegConvention floatingLeg, DaysAdjustment spotDateOffset)
 {
     JodaBeanUtils.notNull(name, "name");
     JodaBeanUtils.notNull(fixedLeg, "fixedLeg");
     JodaBeanUtils.notNull(floatingLeg, "floatingLeg");
     JodaBeanUtils.notNull(spotDateOffset, "spotDateOffset");
     this.name           = name;
     this.fixedLeg       = fixedLeg;
     this.floatingLeg    = floatingLeg;
     this.spotDateOffset = spotDateOffset;
     validate();
 }
Ejemplo n.º 9
0
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         InflationRateSwapLegConvention other = (InflationRateSwapLegConvention)obj;
         return(JodaBeanUtils.equal(index, other.index) && JodaBeanUtils.equal(lag, other.lag) && JodaBeanUtils.equal(indexCalculationMethod, other.indexCalculationMethod) && (notionalExchange == other.notionalExchange) && JodaBeanUtils.equal(paymentDateOffset, other.paymentDateOffset) && JodaBeanUtils.equal(accrualBusinessDayAdjustment, other.accrualBusinessDayAdjustment));
     }
     return(false);
 }
        public virtual void test_serialization()
        {
            InflationRateSwapLegConvention test = InflationRateSwapLegConvention.of(GB_HICP, LAG_3M, MONTHLY, BDA_MOD_FOLLOW);

            assertSerialization(test);
        }
        //-------------------------------------------------------------------------

        /// <summary>
        /// Obtains a convention based on the specified name and leg conventions.
        /// <para>
        /// The two leg conventions must be in the same currency.
        ///
        /// </para>
        /// </summary>
        /// <param name="name">  the unique name of the convention </param>
        /// <param name="fixedLeg">  the market convention for the fixed leg </param>
        /// <param name="floatingLeg">  the market convention for the floating leg </param>
        /// <param name="spotDateOffset">  the offset of the spot value date from the trade date </param>
        /// <returns> the convention </returns>
        public static ImmutableFixedInflationSwapConvention of(string name, FixedRateSwapLegConvention fixedLeg, InflationRateSwapLegConvention floatingLeg, DaysAdjustment spotDateOffset)
        {
            return(new ImmutableFixedInflationSwapConvention(name, fixedLeg, floatingLeg, spotDateOffset));
        }
 /// <summary>
 /// Sets the market convention of the floating leg. </summary>
 /// <param name="floatingLeg">  the new value, not null </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder floatingLeg(InflationRateSwapLegConvention floatingLeg)
 {
     JodaBeanUtils.notNull(floatingLeg, "floatingLeg");
     this.floatingLeg_Renamed = floatingLeg;
     return(this);
 }