1 package org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification;
2 import org.opendaylight.yangtools.yang.binding.AugmentationHolder;
3 import java.util.HashMap;
4 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.MapReply;
5 import org.opendaylight.yangtools.concepts.Builder;
6 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItem;
7 import org.opendaylight.yangtools.yang.binding.Augmentation;
8 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc;
9 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEid;
10 import org.opendaylight.yangtools.yang.binding.DataObject;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.IpAddressBinary;
12 import java.util.Objects;
13 import java.util.List;
14 import java.util.Collections;
15 import java.util.Map;
16
17
18
19
20
21
22
23 public class MapRequestBuilder implements Builder<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest> {
24
25 private List<EidItem> _eidItem;
26 private List<ItrRloc> _itrRloc;
27 private MapReply _mapReply;
28 private java.lang.Long _nonce;
29 private SourceEid _sourceEid;
30 private IpAddressBinary _sourceRloc;
31 private java.lang.Boolean _authoritative;
32 private java.lang.Boolean _mapDataPresent;
33 private java.lang.Boolean _pitr;
34 private java.lang.Boolean _probe;
35 private java.lang.Boolean _smr;
36 private java.lang.Boolean _smrInvoked;
37
38 Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest>> augmentation = Collections.emptyMap();
39
40 public MapRequestBuilder() {
41 }
42 public MapRequestBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest arg) {
43 this._authoritative = arg.isAuthoritative();
44 this._mapDataPresent = arg.isMapDataPresent();
45 this._probe = arg.isProbe();
46 this._smr = arg.isSmr();
47 this._pitr = arg.isPitr();
48 this._smrInvoked = arg.isSmrInvoked();
49 this._nonce = arg.getNonce();
50 this._sourceEid = arg.getSourceEid();
51 this._itrRloc = arg.getItrRloc();
52 this._mapReply = arg.getMapReply();
53 this._eidItem = arg.getEidItem();
54 this._sourceRloc = arg.getSourceRloc();
55 }
56 public MapRequestBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.EidList arg) {
57 this._eidItem = arg.getEidItem();
58 }
59 public MapRequestBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequestMetadata arg) {
60 this._sourceRloc = arg.getSourceRloc();
61 }
62
63 public MapRequestBuilder(MapRequest base) {
64 this._eidItem = base.getEidItem();
65 this._itrRloc = base.getItrRloc();
66 this._mapReply = base.getMapReply();
67 this._nonce = base.getNonce();
68 this._sourceEid = base.getSourceEid();
69 this._sourceRloc = base.getSourceRloc();
70 this._authoritative = base.isAuthoritative();
71 this._mapDataPresent = base.isMapDataPresent();
72 this._pitr = base.isPitr();
73 this._probe = base.isProbe();
74 this._smr = base.isSmr();
75 this._smrInvoked = base.isSmrInvoked();
76 if (base instanceof MapRequestImpl) {
77 MapRequestImpl impl = (MapRequestImpl) base;
78 if (!impl.augmentation.isEmpty()) {
79 this.augmentation = new HashMap<>(impl.augmentation);
80 }
81 } else if (base instanceof AugmentationHolder) {
82 @SuppressWarnings("unchecked")
83 AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest>) base;
84 if (!casted.augmentations().isEmpty()) {
85 this.augmentation = new HashMap<>(casted.augmentations());
86 }
87 }
88 }
89
90
91
92
93
94
95
96
97
98
99
100
101 public void fieldsFrom(DataObject arg) {
102 boolean isValidArg = false;
103 if (arg instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.EidList) {
104 this._eidItem = ((org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.EidList)arg).getEidItem();
105 isValidArg = true;
106 }
107 if (arg instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest) {
108 this._authoritative = ((org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)arg).isAuthoritative();
109 this._mapDataPresent = ((org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)arg).isMapDataPresent();
110 this._probe = ((org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)arg).isProbe();
111 this._smr = ((org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)arg).isSmr();
112 this._pitr = ((org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)arg).isPitr();
113 this._smrInvoked = ((org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)arg).isSmrInvoked();
114 this._nonce = ((org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)arg).getNonce();
115 this._sourceEid = ((org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)arg).getSourceEid();
116 this._itrRloc = ((org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)arg).getItrRloc();
117 this._mapReply = ((org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)arg).getMapReply();
118 isValidArg = true;
119 }
120 if (arg instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequestMetadata) {
121 this._sourceRloc = ((org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequestMetadata)arg).getSourceRloc();
122 isValidArg = true;
123 }
124 if (!isValidArg) {
125 throw new IllegalArgumentException(
126 "expected one of: [org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.EidList, org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest, org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequestMetadata] \n" +
127 "but was: " + arg
128 );
129 }
130 }
131
132 public List<EidItem> getEidItem() {
133 return _eidItem;
134 }
135
136 public List<ItrRloc> getItrRloc() {
137 return _itrRloc;
138 }
139
140 public MapReply getMapReply() {
141 return _mapReply;
142 }
143
144 public java.lang.Long getNonce() {
145 return _nonce;
146 }
147
148 public SourceEid getSourceEid() {
149 return _sourceEid;
150 }
151
152 public IpAddressBinary getSourceRloc() {
153 return _sourceRloc;
154 }
155
156 public java.lang.Boolean isAuthoritative() {
157 return _authoritative;
158 }
159
160 public java.lang.Boolean isMapDataPresent() {
161 return _mapDataPresent;
162 }
163
164 public java.lang.Boolean isPitr() {
165 return _pitr;
166 }
167
168 public java.lang.Boolean isProbe() {
169 return _probe;
170 }
171
172 public java.lang.Boolean isSmr() {
173 return _smr;
174 }
175
176 public java.lang.Boolean isSmrInvoked() {
177 return _smrInvoked;
178 }
179
180 @SuppressWarnings("unchecked")
181 public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest>> E getAugmentation(java.lang.Class<E> augmentationType) {
182 if (augmentationType == null) {
183 throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
184 }
185 return (E) augmentation.get(augmentationType);
186 }
187
188
189 public MapRequestBuilder setEidItem(final List<EidItem> value) {
190 this._eidItem = value;
191 return this;
192 }
193
194
195 public MapRequestBuilder setItrRloc(final List<ItrRloc> value) {
196 this._itrRloc = value;
197 return this;
198 }
199
200
201 public MapRequestBuilder setMapReply(final MapReply value) {
202 this._mapReply = value;
203 return this;
204 }
205
206
207 public MapRequestBuilder setNonce(final java.lang.Long value) {
208 this._nonce = value;
209 return this;
210 }
211
212
213 public MapRequestBuilder setSourceEid(final SourceEid value) {
214 this._sourceEid = value;
215 return this;
216 }
217
218
219 public MapRequestBuilder setSourceRloc(final IpAddressBinary value) {
220 this._sourceRloc = value;
221 return this;
222 }
223
224
225 public MapRequestBuilder setAuthoritative(final java.lang.Boolean value) {
226 this._authoritative = value;
227 return this;
228 }
229
230
231 public MapRequestBuilder setMapDataPresent(final java.lang.Boolean value) {
232 this._mapDataPresent = value;
233 return this;
234 }
235
236
237 public MapRequestBuilder setPitr(final java.lang.Boolean value) {
238 this._pitr = value;
239 return this;
240 }
241
242
243 public MapRequestBuilder setProbe(final java.lang.Boolean value) {
244 this._probe = value;
245 return this;
246 }
247
248
249 public MapRequestBuilder setSmr(final java.lang.Boolean value) {
250 this._smr = value;
251 return this;
252 }
253
254
255 public MapRequestBuilder setSmrInvoked(final java.lang.Boolean value) {
256 this._smrInvoked = value;
257 return this;
258 }
259
260 public MapRequestBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest> augmentation) {
261 if (augmentation == null) {
262 return removeAugmentation(augmentationType);
263 }
264
265 if (!(this.augmentation instanceof HashMap)) {
266 this.augmentation = new HashMap<>();
267 }
268
269 this.augmentation.put(augmentationType, augmentation);
270 return this;
271 }
272
273 public MapRequestBuilder removeAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest>> augmentationType) {
274 if (this.augmentation instanceof HashMap) {
275 this.augmentation.remove(augmentationType);
276 }
277 return this;
278 }
279
280 @Override
281 public MapRequest build() {
282 return new MapRequestImpl(this);
283 }
284
285 private static final class MapRequestImpl implements MapRequest {
286
287 @Override
288 public java.lang.Class<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest> getImplementedInterface() {
289 return org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest.class;
290 }
291
292 private final List<EidItem> _eidItem;
293 private final List<ItrRloc> _itrRloc;
294 private final MapReply _mapReply;
295 private final java.lang.Long _nonce;
296 private final SourceEid _sourceEid;
297 private final IpAddressBinary _sourceRloc;
298 private final java.lang.Boolean _authoritative;
299 private final java.lang.Boolean _mapDataPresent;
300 private final java.lang.Boolean _pitr;
301 private final java.lang.Boolean _probe;
302 private final java.lang.Boolean _smr;
303 private final java.lang.Boolean _smrInvoked;
304
305 private Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest>> augmentation = Collections.emptyMap();
306
307 private MapRequestImpl(MapRequestBuilder base) {
308 this._eidItem = base.getEidItem();
309 this._itrRloc = base.getItrRloc();
310 this._mapReply = base.getMapReply();
311 this._nonce = base.getNonce();
312 this._sourceEid = base.getSourceEid();
313 this._sourceRloc = base.getSourceRloc();
314 this._authoritative = base.isAuthoritative();
315 this._mapDataPresent = base.isMapDataPresent();
316 this._pitr = base.isPitr();
317 this._probe = base.isProbe();
318 this._smr = base.isSmr();
319 this._smrInvoked = base.isSmrInvoked();
320 switch (base.augmentation.size()) {
321 case 0:
322 this.augmentation = Collections.emptyMap();
323 break;
324 case 1:
325 final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest>> e = base.augmentation.entrySet().iterator().next();
326 this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest>>singletonMap(e.getKey(), e.getValue());
327 break;
328 default :
329 this.augmentation = new HashMap<>(base.augmentation);
330 }
331 }
332
333 @Override
334 public List<EidItem> getEidItem() {
335 return _eidItem;
336 }
337
338 @Override
339 public List<ItrRloc> getItrRloc() {
340 return _itrRloc;
341 }
342
343 @Override
344 public MapReply getMapReply() {
345 return _mapReply;
346 }
347
348 @Override
349 public java.lang.Long getNonce() {
350 return _nonce;
351 }
352
353 @Override
354 public SourceEid getSourceEid() {
355 return _sourceEid;
356 }
357
358 @Override
359 public IpAddressBinary getSourceRloc() {
360 return _sourceRloc;
361 }
362
363 @Override
364 public java.lang.Boolean isAuthoritative() {
365 return _authoritative;
366 }
367
368 @Override
369 public java.lang.Boolean isMapDataPresent() {
370 return _mapDataPresent;
371 }
372
373 @Override
374 public java.lang.Boolean isPitr() {
375 return _pitr;
376 }
377
378 @Override
379 public java.lang.Boolean isProbe() {
380 return _probe;
381 }
382
383 @Override
384 public java.lang.Boolean isSmr() {
385 return _smr;
386 }
387
388 @Override
389 public java.lang.Boolean isSmrInvoked() {
390 return _smrInvoked;
391 }
392
393 @SuppressWarnings("unchecked")
394 @Override
395 public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest>> E getAugmentation(java.lang.Class<E> augmentationType) {
396 if (augmentationType == null) {
397 throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
398 }
399 return (E) augmentation.get(augmentationType);
400 }
401
402 private int hash = 0;
403 private volatile boolean hashValid = false;
404
405 @Override
406 public int hashCode() {
407 if (hashValid) {
408 return hash;
409 }
410
411 final int prime = 31;
412 int result = 1;
413 result = prime * result + Objects.hashCode(_eidItem);
414 result = prime * result + Objects.hashCode(_itrRloc);
415 result = prime * result + Objects.hashCode(_mapReply);
416 result = prime * result + Objects.hashCode(_nonce);
417 result = prime * result + Objects.hashCode(_sourceEid);
418 result = prime * result + Objects.hashCode(_sourceRloc);
419 result = prime * result + Objects.hashCode(_authoritative);
420 result = prime * result + Objects.hashCode(_mapDataPresent);
421 result = prime * result + Objects.hashCode(_pitr);
422 result = prime * result + Objects.hashCode(_probe);
423 result = prime * result + Objects.hashCode(_smr);
424 result = prime * result + Objects.hashCode(_smrInvoked);
425 result = prime * result + Objects.hashCode(augmentation);
426
427 hash = result;
428 hashValid = true;
429 return result;
430 }
431
432 @Override
433 public boolean equals(java.lang.Object obj) {
434 if (this == obj) {
435 return true;
436 }
437 if (!(obj instanceof DataObject)) {
438 return false;
439 }
440 if (!org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest.class.equals(((DataObject)obj).getImplementedInterface())) {
441 return false;
442 }
443 org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest other = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest)obj;
444 if (!Objects.equals(_eidItem, other.getEidItem())) {
445 return false;
446 }
447 if (!Objects.equals(_itrRloc, other.getItrRloc())) {
448 return false;
449 }
450 if (!Objects.equals(_mapReply, other.getMapReply())) {
451 return false;
452 }
453 if (!Objects.equals(_nonce, other.getNonce())) {
454 return false;
455 }
456 if (!Objects.equals(_sourceEid, other.getSourceEid())) {
457 return false;
458 }
459 if (!Objects.equals(_sourceRloc, other.getSourceRloc())) {
460 return false;
461 }
462 if (!Objects.equals(_authoritative, other.isAuthoritative())) {
463 return false;
464 }
465 if (!Objects.equals(_mapDataPresent, other.isMapDataPresent())) {
466 return false;
467 }
468 if (!Objects.equals(_pitr, other.isPitr())) {
469 return false;
470 }
471 if (!Objects.equals(_probe, other.isProbe())) {
472 return false;
473 }
474 if (!Objects.equals(_smr, other.isSmr())) {
475 return false;
476 }
477 if (!Objects.equals(_smrInvoked, other.isSmrInvoked())) {
478 return false;
479 }
480 if (getClass() == obj.getClass()) {
481
482 MapRequestImpl otherImpl = (MapRequestImpl) obj;
483 if (!Objects.equals(augmentation, otherImpl.augmentation)) {
484 return false;
485 }
486 } else {
487
488 for (Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest>> e : augmentation.entrySet()) {
489 if (!e.getValue().equals(other.getAugmentation(e.getKey()))) {
490 return false;
491 }
492 }
493
494 if (!obj.equals(this)) {
495 return false;
496 }
497 }
498 return true;
499 }
500
501 @Override
502 public java.lang.String toString() {
503 java.lang.String name = "MapRequest [";
504 java.lang.StringBuilder builder = new java.lang.StringBuilder (name);
505 if (_eidItem != null) {
506 builder.append("_eidItem=");
507 builder.append(_eidItem);
508 builder.append(", ");
509 }
510 if (_itrRloc != null) {
511 builder.append("_itrRloc=");
512 builder.append(_itrRloc);
513 builder.append(", ");
514 }
515 if (_mapReply != null) {
516 builder.append("_mapReply=");
517 builder.append(_mapReply);
518 builder.append(", ");
519 }
520 if (_nonce != null) {
521 builder.append("_nonce=");
522 builder.append(_nonce);
523 builder.append(", ");
524 }
525 if (_sourceEid != null) {
526 builder.append("_sourceEid=");
527 builder.append(_sourceEid);
528 builder.append(", ");
529 }
530 if (_sourceRloc != null) {
531 builder.append("_sourceRloc=");
532 builder.append(_sourceRloc);
533 builder.append(", ");
534 }
535 if (_authoritative != null) {
536 builder.append("_authoritative=");
537 builder.append(_authoritative);
538 builder.append(", ");
539 }
540 if (_mapDataPresent != null) {
541 builder.append("_mapDataPresent=");
542 builder.append(_mapDataPresent);
543 builder.append(", ");
544 }
545 if (_pitr != null) {
546 builder.append("_pitr=");
547 builder.append(_pitr);
548 builder.append(", ");
549 }
550 if (_probe != null) {
551 builder.append("_probe=");
552 builder.append(_probe);
553 builder.append(", ");
554 }
555 if (_smr != null) {
556 builder.append("_smr=");
557 builder.append(_smr);
558 builder.append(", ");
559 }
560 if (_smrInvoked != null) {
561 builder.append("_smrInvoked=");
562 builder.append(_smrInvoked);
563 }
564 final int builderLength = builder.length();
565 final int builderAdditionalLength = builder.substring(name.length(), builderLength).length();
566 if (builderAdditionalLength > 2 && !builder.substring(builderLength - 2, builderLength).equals(", ")) {
567 builder.append(", ");
568 }
569 builder.append("augmentation=");
570 builder.append(augmentation.values());
571 return builder.append(']').toString();
572 }
573 }
574
575 }