/
InflationRateSwapLegConvention.java
809 lines (742 loc) · 29 KB
/
InflationRateSwapLegConvention.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
/*
* Copyright (C) 2016 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.strata.product.swap.type;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.Period;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import org.joda.beans.Bean;
import org.joda.beans.BeanDefinition;
import org.joda.beans.ImmutableBean;
import org.joda.beans.ImmutableDefaults;
import org.joda.beans.JodaBeanUtils;
import org.joda.beans.MetaProperty;
import org.joda.beans.Property;
import org.joda.beans.PropertyDefinition;
import org.joda.beans.impl.direct.DirectFieldsBeanBuilder;
import org.joda.beans.impl.direct.DirectMetaBean;
import org.joda.beans.impl.direct.DirectMetaProperty;
import org.joda.beans.impl.direct.DirectMetaPropertyMap;
import com.opengamma.strata.basics.currency.Currency;
import com.opengamma.strata.basics.date.BusinessDayAdjustment;
import com.opengamma.strata.basics.date.DaysAdjustment;
import com.opengamma.strata.basics.index.PriceIndex;
import com.opengamma.strata.basics.schedule.Frequency;
import com.opengamma.strata.basics.schedule.PeriodicSchedule;
import com.opengamma.strata.product.common.PayReceive;
import com.opengamma.strata.product.swap.InflationRateCalculation;
import com.opengamma.strata.product.swap.NotionalSchedule;
import com.opengamma.strata.product.swap.PaymentSchedule;
import com.opengamma.strata.product.swap.PriceIndexCalculationMethod;
import com.opengamma.strata.product.swap.RateCalculationSwapLeg;
/**
* A market convention for the floating leg of rate swap trades based on a price index.
* <p>
* This defines the market convention for a floating leg based on the observed value
* of a Price index such as 'GB-HICP' or 'US-CPI-U'.
*/
@BeanDefinition
public final class InflationRateSwapLegConvention
implements SwapLegConvention, ImmutableBean, Serializable {
/**
* The Price index.
* <p>
* The floating rate to be paid is based on this price index
* It will be a well known price index such as 'GB-HICP'.
*/
@PropertyDefinition(validate = "notNull")
private final PriceIndex index;
/**
* The positive period between the price index and the accrual date,
* typically a number of months.
* <p>
* A price index is typically published monthly and has a delay before publication.
* The lag is subtracted from the accrual start and end date to locate the
* month of the data to be observed.
* <p>
* For example, the September data may be published in October or November.
* A 3 month lag will cause an accrual date in December to be based on the
* observed data for September, which should be available by then.
*/
@PropertyDefinition(validate = "notNull")
private final Period lag;
/**
* Reference price index calculation method.
* <p>
* This specifies how the reference index calculation occurs.
* <p>
* This will default to 'Monthly' if not specified.
*/
@PropertyDefinition(validate = "notNull")
private final PriceIndexCalculationMethod indexCalculationMethod;
/**
* The flag indicating whether to exchange the notional.
* <p>
* If 'true', the notional there is both an initial exchange and a final exchange of notional.
* <p>
* This will default to 'false' if not specified.
*/
@PropertyDefinition
private final boolean notionalExchange;
/**
* The offset of payment from the base date, optional with defaulting getter.
* <p>
* The offset is applied to the unadjusted date specified by {@code paymentRelativeTo}.
* Offset can be based on calendar days or business days.
* <p>
* This will default to 'None' if not specified.
*/
@PropertyDefinition(get = "field")
private final DaysAdjustment paymentDateOffset;
/**
* The business day adjustment to apply to accrual schedule dates.
* <p>
* Each date in the calculated schedule is determined without taking into account weekends and holidays.
* The adjustment specified here is used to convert those dates to valid business days.
* <p>
* The start date and end date may have their own business day adjustment rules.
* If those are not present, then this adjustment is used instead.
* <p>
* This will default to 'ModifiedFollowing' using the index fixing calendar if not specified.
*/
@PropertyDefinition(get = "field")
private final BusinessDayAdjustment accrualBusinessDayAdjustment;
//-------------------------------------------------------------------------
/**
* Obtains a convention based on the specified index, defaulting the PriceIndexCalculationMethod to MONTHLY.
* <p>
* The standard market convention for an Inflation rate leg is based on the index.
* Use the {@linkplain #builder() builder} for unusual conventions.
*
* @param index the index, the market convention values are extracted from the index
* @param lag the lag between the price index and the accrual date, typically a number of months
* @param businessDayAdjustment the business day
* @return the convention
* @deprecated Use of() method which takes {@link PriceIndexCalculationMethod} parameter
*/
@Deprecated
public static InflationRateSwapLegConvention of(
PriceIndex index,
Period lag,
BusinessDayAdjustment businessDayAdjustment) {
return of(index, lag, PriceIndexCalculationMethod.MONTHLY, businessDayAdjustment);
}
/**
* Obtains a convention based on the specified index.
* <p>
* The standard market convention for an Inflation rate leg is based on the index.
* Use the {@linkplain #builder() builder} for unusual conventions.
*
* @param index the index, the market convention values are extracted from the index
* @param lag the lag between the price index and the accrual date, typically a number of months
* @param priceIndexCalculationMethod the price index calculation method, typically interpolated or monthly
* @param businessDayAdjustment the business day
* @return the convention
*/
public static InflationRateSwapLegConvention of(
PriceIndex index,
Period lag,
PriceIndexCalculationMethod priceIndexCalculationMethod,
BusinessDayAdjustment businessDayAdjustment) {
return new InflationRateSwapLegConvention(
index,
lag,
priceIndexCalculationMethod,
false,
DaysAdjustment.NONE,
businessDayAdjustment);
}
//-------------------------------------------------------------------------
@ImmutableDefaults
private static void applyDefaults(Builder builder) {
builder.indexCalculationMethod = PriceIndexCalculationMethod.MONTHLY;
}
//-------------------------------------------------------------------------
/**
* Gets the currency of the leg from the index.
*
* @return the currency
*/
public Currency getCurrency() {
return index.getCurrency();
}
//-------------------------------------------------------------------------
/**
* Creates a leg based on this convention.
* <p>
* This returns a leg based on the specified date.
* The notional is unsigned, with pay/receive determining the direction of the leg.
* If the leg is 'Pay', the fixed rate is paid to the counterparty.
* If the leg is 'Receive', the fixed rate is received from the counterparty.
*
* @param startDate the start date
* @param endDate the end date
* @param payReceive determines if the leg is to be paid or received
* @param notional the business day adjustment to apply to accrual schedule dates
* @return the leg
*/
public RateCalculationSwapLeg toLeg(
LocalDate startDate,
LocalDate endDate,
PayReceive payReceive,
double notional) {
return RateCalculationSwapLeg
.builder()
.payReceive(payReceive)
.accrualSchedule(PeriodicSchedule.builder()
.startDate(startDate)
.endDate(endDate)
.frequency(Frequency.TERM)
.businessDayAdjustment(accrualBusinessDayAdjustment)
.build())
.paymentSchedule(PaymentSchedule.builder()
.paymentFrequency(Frequency.TERM)
.paymentDateOffset(paymentDateOffset)
.build())
.calculation(InflationRateCalculation.builder()
.index(index)
.indexCalculationMethod(indexCalculationMethod)
.lag(lag)
.build())
.notionalSchedule(NotionalSchedule.of(getCurrency(), notional))
.build();
}
//------------------------- AUTOGENERATED START -------------------------
///CLOVER:OFF
/**
* The meta-bean for {@code InflationRateSwapLegConvention}.
* @return the meta-bean, not null
*/
public static InflationRateSwapLegConvention.Meta meta() {
return InflationRateSwapLegConvention.Meta.INSTANCE;
}
static {
JodaBeanUtils.registerMetaBean(InflationRateSwapLegConvention.Meta.INSTANCE);
}
/**
* The serialization version id.
*/
private static final long serialVersionUID = 1L;
/**
* Returns a builder used to create an instance of the bean.
* @return the builder, not null
*/
public static InflationRateSwapLegConvention.Builder builder() {
return new InflationRateSwapLegConvention.Builder();
}
private InflationRateSwapLegConvention(
PriceIndex index,
Period lag,
PriceIndexCalculationMethod indexCalculationMethod,
boolean notionalExchange,
DaysAdjustment paymentDateOffset,
BusinessDayAdjustment accrualBusinessDayAdjustment) {
JodaBeanUtils.notNull(index, "index");
JodaBeanUtils.notNull(lag, "lag");
JodaBeanUtils.notNull(indexCalculationMethod, "indexCalculationMethod");
this.index = index;
this.lag = lag;
this.indexCalculationMethod = indexCalculationMethod;
this.notionalExchange = notionalExchange;
this.paymentDateOffset = paymentDateOffset;
this.accrualBusinessDayAdjustment = accrualBusinessDayAdjustment;
}
@Override
public InflationRateSwapLegConvention.Meta metaBean() {
return InflationRateSwapLegConvention.Meta.INSTANCE;
}
@Override
public <R> Property<R> property(String propertyName) {
return metaBean().<R>metaProperty(propertyName).createProperty(this);
}
@Override
public Set<String> propertyNames() {
return metaBean().metaPropertyMap().keySet();
}
//-----------------------------------------------------------------------
/**
* Gets the Price index.
* <p>
* The floating rate to be paid is based on this price index
* It will be a well known price index such as 'GB-HICP'.
* @return the value of the property, not null
*/
public PriceIndex getIndex() {
return index;
}
//-----------------------------------------------------------------------
/**
* Gets the positive period between the price index and the accrual date,
* typically a number of months.
* <p>
* A price index is typically published monthly and has a delay before publication.
* The lag is subtracted from the accrual start and end date to locate the
* month of the data to be observed.
* <p>
* For example, the September data may be published in October or November.
* A 3 month lag will cause an accrual date in December to be based on the
* observed data for September, which should be available by then.
* @return the value of the property, not null
*/
public Period getLag() {
return lag;
}
//-----------------------------------------------------------------------
/**
* Gets reference price index calculation method.
* <p>
* This specifies how the reference index calculation occurs.
* <p>
* This will default to 'Monthly' if not specified.
* @return the value of the property, not null
*/
public PriceIndexCalculationMethod getIndexCalculationMethod() {
return indexCalculationMethod;
}
//-----------------------------------------------------------------------
/**
* Gets the flag indicating whether to exchange the notional.
* <p>
* If 'true', the notional there is both an initial exchange and a final exchange of notional.
* <p>
* This will default to 'false' if not specified.
* @return the value of the property
*/
public boolean isNotionalExchange() {
return notionalExchange;
}
//-----------------------------------------------------------------------
/**
* Returns a builder that allows this bean to be mutated.
* @return the mutable builder, not null
*/
public Builder toBuilder() {
return new Builder(this);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj != null && obj.getClass() == this.getClass()) {
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;
}
@Override
public int hashCode() {
int hash = getClass().hashCode();
hash = hash * 31 + JodaBeanUtils.hashCode(index);
hash = hash * 31 + JodaBeanUtils.hashCode(lag);
hash = hash * 31 + JodaBeanUtils.hashCode(indexCalculationMethod);
hash = hash * 31 + JodaBeanUtils.hashCode(notionalExchange);
hash = hash * 31 + JodaBeanUtils.hashCode(paymentDateOffset);
hash = hash * 31 + JodaBeanUtils.hashCode(accrualBusinessDayAdjustment);
return hash;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(224);
buf.append("InflationRateSwapLegConvention{");
buf.append("index").append('=').append(index).append(',').append(' ');
buf.append("lag").append('=').append(lag).append(',').append(' ');
buf.append("indexCalculationMethod").append('=').append(indexCalculationMethod).append(',').append(' ');
buf.append("notionalExchange").append('=').append(notionalExchange).append(',').append(' ');
buf.append("paymentDateOffset").append('=').append(paymentDateOffset).append(',').append(' ');
buf.append("accrualBusinessDayAdjustment").append('=').append(JodaBeanUtils.toString(accrualBusinessDayAdjustment));
buf.append('}');
return buf.toString();
}
//-----------------------------------------------------------------------
/**
* The meta-bean for {@code InflationRateSwapLegConvention}.
*/
public static final class Meta extends DirectMetaBean {
/**
* The singleton instance of the meta-bean.
*/
static final Meta INSTANCE = new Meta();
/**
* The meta-property for the {@code index} property.
*/
private final MetaProperty<PriceIndex> index = DirectMetaProperty.ofImmutable(
this, "index", InflationRateSwapLegConvention.class, PriceIndex.class);
/**
* The meta-property for the {@code lag} property.
*/
private final MetaProperty<Period> lag = DirectMetaProperty.ofImmutable(
this, "lag", InflationRateSwapLegConvention.class, Period.class);
/**
* The meta-property for the {@code indexCalculationMethod} property.
*/
private final MetaProperty<PriceIndexCalculationMethod> indexCalculationMethod = DirectMetaProperty.ofImmutable(
this, "indexCalculationMethod", InflationRateSwapLegConvention.class, PriceIndexCalculationMethod.class);
/**
* The meta-property for the {@code notionalExchange} property.
*/
private final MetaProperty<Boolean> notionalExchange = DirectMetaProperty.ofImmutable(
this, "notionalExchange", InflationRateSwapLegConvention.class, Boolean.TYPE);
/**
* The meta-property for the {@code paymentDateOffset} property.
*/
private final MetaProperty<DaysAdjustment> paymentDateOffset = DirectMetaProperty.ofImmutable(
this, "paymentDateOffset", InflationRateSwapLegConvention.class, DaysAdjustment.class);
/**
* The meta-property for the {@code accrualBusinessDayAdjustment} property.
*/
private final MetaProperty<BusinessDayAdjustment> accrualBusinessDayAdjustment = DirectMetaProperty.ofImmutable(
this, "accrualBusinessDayAdjustment", InflationRateSwapLegConvention.class, BusinessDayAdjustment.class);
/**
* The meta-properties.
*/
private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(
this, null,
"index",
"lag",
"indexCalculationMethod",
"notionalExchange",
"paymentDateOffset",
"accrualBusinessDayAdjustment");
/**
* Restricted constructor.
*/
private Meta() {
}
@Override
protected MetaProperty<?> metaPropertyGet(String propertyName) {
switch (propertyName.hashCode()) {
case 100346066: // index
return index;
case 106898: // lag
return lag;
case -1409010088: // indexCalculationMethod
return indexCalculationMethod;
case -159410813: // notionalExchange
return notionalExchange;
case -716438393: // paymentDateOffset
return paymentDateOffset;
case 896049114: // accrualBusinessDayAdjustment
return accrualBusinessDayAdjustment;
}
return super.metaPropertyGet(propertyName);
}
@Override
public InflationRateSwapLegConvention.Builder builder() {
return new InflationRateSwapLegConvention.Builder();
}
@Override
public Class<? extends InflationRateSwapLegConvention> beanType() {
return InflationRateSwapLegConvention.class;
}
@Override
public Map<String, MetaProperty<?>> metaPropertyMap() {
return metaPropertyMap$;
}
//-----------------------------------------------------------------------
/**
* The meta-property for the {@code index} property.
* @return the meta-property, not null
*/
public MetaProperty<PriceIndex> index() {
return index;
}
/**
* The meta-property for the {@code lag} property.
* @return the meta-property, not null
*/
public MetaProperty<Period> lag() {
return lag;
}
/**
* The meta-property for the {@code indexCalculationMethod} property.
* @return the meta-property, not null
*/
public MetaProperty<PriceIndexCalculationMethod> indexCalculationMethod() {
return indexCalculationMethod;
}
/**
* The meta-property for the {@code notionalExchange} property.
* @return the meta-property, not null
*/
public MetaProperty<Boolean> notionalExchange() {
return notionalExchange;
}
/**
* The meta-property for the {@code paymentDateOffset} property.
* @return the meta-property, not null
*/
public MetaProperty<DaysAdjustment> paymentDateOffset() {
return paymentDateOffset;
}
/**
* The meta-property for the {@code accrualBusinessDayAdjustment} property.
* @return the meta-property, not null
*/
public MetaProperty<BusinessDayAdjustment> accrualBusinessDayAdjustment() {
return accrualBusinessDayAdjustment;
}
//-----------------------------------------------------------------------
@Override
protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
switch (propertyName.hashCode()) {
case 100346066: // index
return ((InflationRateSwapLegConvention) bean).getIndex();
case 106898: // lag
return ((InflationRateSwapLegConvention) bean).getLag();
case -1409010088: // indexCalculationMethod
return ((InflationRateSwapLegConvention) bean).getIndexCalculationMethod();
case -159410813: // notionalExchange
return ((InflationRateSwapLegConvention) bean).isNotionalExchange();
case -716438393: // paymentDateOffset
return ((InflationRateSwapLegConvention) bean).paymentDateOffset;
case 896049114: // accrualBusinessDayAdjustment
return ((InflationRateSwapLegConvention) bean).accrualBusinessDayAdjustment;
}
return super.propertyGet(bean, propertyName, quiet);
}
@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);
}
}
//-----------------------------------------------------------------------
/**
* The bean-builder for {@code InflationRateSwapLegConvention}.
*/
public static final class Builder extends DirectFieldsBeanBuilder<InflationRateSwapLegConvention> {
private PriceIndex index;
private Period lag;
private PriceIndexCalculationMethod indexCalculationMethod;
private boolean notionalExchange;
private DaysAdjustment paymentDateOffset;
private BusinessDayAdjustment accrualBusinessDayAdjustment;
/**
* Restricted constructor.
*/
private Builder() {
applyDefaults(this);
}
/**
* Restricted copy constructor.
* @param beanToCopy the bean to copy from, not null
*/
private Builder(InflationRateSwapLegConvention beanToCopy) {
this.index = beanToCopy.getIndex();
this.lag = beanToCopy.getLag();
this.indexCalculationMethod = beanToCopy.getIndexCalculationMethod();
this.notionalExchange = beanToCopy.isNotionalExchange();
this.paymentDateOffset = beanToCopy.paymentDateOffset;
this.accrualBusinessDayAdjustment = beanToCopy.accrualBusinessDayAdjustment;
}
//-----------------------------------------------------------------------
@Override
public Object get(String propertyName) {
switch (propertyName.hashCode()) {
case 100346066: // index
return index;
case 106898: // lag
return lag;
case -1409010088: // indexCalculationMethod
return indexCalculationMethod;
case -159410813: // notionalExchange
return notionalExchange;
case -716438393: // paymentDateOffset
return paymentDateOffset;
case 896049114: // accrualBusinessDayAdjustment
return accrualBusinessDayAdjustment;
default:
throw new NoSuchElementException("Unknown property: " + propertyName);
}
}
@Override
public Builder set(String propertyName, Object newValue) {
switch (propertyName.hashCode()) {
case 100346066: // index
this.index = (PriceIndex) newValue;
break;
case 106898: // lag
this.lag = (Period) newValue;
break;
case -1409010088: // indexCalculationMethod
this.indexCalculationMethod = (PriceIndexCalculationMethod) newValue;
break;
case -159410813: // notionalExchange
this.notionalExchange = (Boolean) newValue;
break;
case -716438393: // paymentDateOffset
this.paymentDateOffset = (DaysAdjustment) newValue;
break;
case 896049114: // accrualBusinessDayAdjustment
this.accrualBusinessDayAdjustment = (BusinessDayAdjustment) newValue;
break;
default:
throw new NoSuchElementException("Unknown property: " + propertyName);
}
return this;
}
@Override
public Builder set(MetaProperty<?> property, Object value) {
super.set(property, value);
return this;
}
/**
* @deprecated Use Joda-Convert in application code
*/
@Override
@Deprecated
public Builder setString(String propertyName, String value) {
setString(meta().metaProperty(propertyName), value);
return this;
}
/**
* @deprecated Use Joda-Convert in application code
*/
@Override
@Deprecated
public Builder setString(MetaProperty<?> property, String value) {
super.setString(property, value);
return this;
}
/**
* @deprecated Loop in application code
*/
@Override
@Deprecated
public Builder setAll(Map<String, ? extends Object> propertyValueMap) {
super.setAll(propertyValueMap);
return this;
}
@Override
public InflationRateSwapLegConvention build() {
return new InflationRateSwapLegConvention(
index,
lag,
indexCalculationMethod,
notionalExchange,
paymentDateOffset,
accrualBusinessDayAdjustment);
}
//-----------------------------------------------------------------------
/**
* Sets the Price index.
* <p>
* The floating rate to be paid is based on this price index
* It will be a well known price index such as 'GB-HICP'.
* @param index the new value, not null
* @return this, for chaining, not null
*/
public Builder index(PriceIndex index) {
JodaBeanUtils.notNull(index, "index");
this.index = index;
return this;
}
/**
* Sets the positive period between the price index and the accrual date,
* typically a number of months.
* <p>
* A price index is typically published monthly and has a delay before publication.
* The lag is subtracted from the accrual start and end date to locate the
* month of the data to be observed.
* <p>
* For example, the September data may be published in October or November.
* A 3 month lag will cause an accrual date in December to be based on the
* observed data for September, which should be available by then.
* @param lag the new value, not null
* @return this, for chaining, not null
*/
public Builder lag(Period lag) {
JodaBeanUtils.notNull(lag, "lag");
this.lag = lag;
return this;
}
/**
* Sets reference price index calculation method.
* <p>
* This specifies how the reference index calculation occurs.
* <p>
* This will default to 'Monthly' if not specified.
* @param indexCalculationMethod the new value, not null
* @return this, for chaining, not null
*/
public Builder indexCalculationMethod(PriceIndexCalculationMethod indexCalculationMethod) {
JodaBeanUtils.notNull(indexCalculationMethod, "indexCalculationMethod");
this.indexCalculationMethod = indexCalculationMethod;
return this;
}
/**
* Sets the flag indicating whether to exchange the notional.
* <p>
* If 'true', the notional there is both an initial exchange and a final exchange of notional.
* <p>
* This will default to 'false' if not specified.
* @param notionalExchange the new value
* @return this, for chaining, not null
*/
public Builder notionalExchange(boolean notionalExchange) {
this.notionalExchange = notionalExchange;
return this;
}
/**
* Sets the offset of payment from the base date, optional with defaulting getter.
* <p>
* The offset is applied to the unadjusted date specified by {@code paymentRelativeTo}.
* Offset can be based on calendar days or business days.
* <p>
* This will default to 'None' if not specified.
* @param paymentDateOffset the new value
* @return this, for chaining, not null
*/
public Builder paymentDateOffset(DaysAdjustment paymentDateOffset) {
this.paymentDateOffset = paymentDateOffset;
return this;
}
/**
* Sets the business day adjustment to apply to accrual schedule dates.
* <p>
* Each date in the calculated schedule is determined without taking into account weekends and holidays.
* The adjustment specified here is used to convert those dates to valid business days.
* <p>
* The start date and end date may have their own business day adjustment rules.
* If those are not present, then this adjustment is used instead.
* <p>
* This will default to 'ModifiedFollowing' using the index fixing calendar if not specified.
* @param accrualBusinessDayAdjustment the new value
* @return this, for chaining, not null
*/
public Builder accrualBusinessDayAdjustment(BusinessDayAdjustment accrualBusinessDayAdjustment) {
this.accrualBusinessDayAdjustment = accrualBusinessDayAdjustment;
return this;
}
//-----------------------------------------------------------------------
@Override
public String toString() {
StringBuilder buf = new StringBuilder(224);
buf.append("InflationRateSwapLegConvention.Builder{");
buf.append("index").append('=').append(JodaBeanUtils.toString(index)).append(',').append(' ');
buf.append("lag").append('=').append(JodaBeanUtils.toString(lag)).append(',').append(' ');
buf.append("indexCalculationMethod").append('=').append(JodaBeanUtils.toString(indexCalculationMethod)).append(',').append(' ');
buf.append("notionalExchange").append('=').append(JodaBeanUtils.toString(notionalExchange)).append(',').append(' ');
buf.append("paymentDateOffset").append('=').append(JodaBeanUtils.toString(paymentDateOffset)).append(',').append(' ');
buf.append("accrualBusinessDayAdjustment").append('=').append(JodaBeanUtils.toString(accrualBusinessDayAdjustment));
buf.append('}');
return buf.toString();
}
}
///CLOVER:ON
//-------------------------- AUTOGENERATED END --------------------------
}