add new devicemanager
[ccsdk/features.git] / sdnr / wt / devicemanager-gran / provider / src / main / java / org / opendaylight / yang / gen / v1 / urn / _3gpp / tsg / sa5 / nrm / types / rev180731 / ipendpoint / address / Ipv6PrefixBuilder.java
1 package org.opendaylight.yang.gen.v1.urn._3gpp.tsg.sa5.nrm.types.rev180731.ipendpoint.address;
2 import com.google.common.base.MoreObjects;
3 import com.google.common.collect.ImmutableMap;
4 import java.lang.Class;
5 import java.lang.Object;
6 import java.lang.Override;
7 import java.lang.String;
8 import java.lang.SuppressWarnings;
9 import java.util.Collections;
10 import java.util.HashMap;
11 import java.util.Map;
12 import java.util.Objects;
13 import org.opendaylight.yangtools.concepts.Builder;
14 import org.opendaylight.yangtools.yang.binding.Augmentation;
15 import org.opendaylight.yangtools.yang.binding.AugmentationHolder;
16 import org.opendaylight.yangtools.yang.binding.CodeHelpers;
17 import org.opendaylight.yangtools.yang.binding.DataObject;
18
19 /**
20  * Class that builds {@link Ipv6PrefixBuilder} instances.
21  *
22  * @see Ipv6PrefixBuilder
23  *
24  */
25 public class Ipv6PrefixBuilder implements Builder<Ipv6Prefix> {
26
27     private org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix _ipv6Prefix;
28
29
30     Map<Class<? extends Augmentation<Ipv6Prefix>>, Augmentation<Ipv6Prefix>> augmentation = Collections.emptyMap();
31
32     public Ipv6PrefixBuilder() {
33     }
34
35     public Ipv6PrefixBuilder(Ipv6Prefix base) {
36         this._ipv6Prefix = base.getIpv6Prefix();
37         if (base instanceof Ipv6PrefixImpl) {
38             Ipv6PrefixImpl impl = (Ipv6PrefixImpl) base;
39             if (!impl.augmentation.isEmpty()) {
40                 this.augmentation = new HashMap<>(impl.augmentation);
41             }
42         } else if (base instanceof AugmentationHolder) {
43             @SuppressWarnings("unchecked")
44             Map<Class<? extends Augmentation<Ipv6Prefix>>, Augmentation<Ipv6Prefix>> aug =((AugmentationHolder<Ipv6Prefix>) base).augmentations();
45             if (!aug.isEmpty()) {
46                 this.augmentation = new HashMap<>(aug);
47             }
48         }
49     }
50
51
52     public org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix getIpv6Prefix() {
53         return _ipv6Prefix;
54     }
55     
56     @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"})
57     public <E$$ extends Augmentation<Ipv6Prefix>> E$$ augmentation(Class<E$$> augmentationType) {
58         return (E$$) augmentation.get(CodeHelpers.nonNullValue(augmentationType, "augmentationType"));
59     }
60
61     
62     public Ipv6PrefixBuilder setIpv6Prefix(final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix value) {
63         this._ipv6Prefix = value;
64         return this;
65     }
66     
67     public Ipv6PrefixBuilder addAugmentation(Class<? extends Augmentation<Ipv6Prefix>> augmentationType, Augmentation<Ipv6Prefix> augmentationValue) {
68         if (augmentationValue == null) {
69             return removeAugmentation(augmentationType);
70         }
71     
72         if (!(this.augmentation instanceof HashMap)) {
73             this.augmentation = new HashMap<>();
74         }
75     
76         this.augmentation.put(augmentationType, augmentationValue);
77         return this;
78     }
79     
80     public Ipv6PrefixBuilder removeAugmentation(Class<? extends Augmentation<Ipv6Prefix>> augmentationType) {
81         if (this.augmentation instanceof HashMap) {
82             this.augmentation.remove(augmentationType);
83         }
84         return this;
85     }
86
87     @Override
88     public Ipv6Prefix build() {
89         return new Ipv6PrefixImpl(this);
90     }
91
92     private static final class Ipv6PrefixImpl implements Ipv6Prefix {
93     
94         private final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix _ipv6Prefix;
95     
96         private Map<Class<? extends Augmentation<Ipv6Prefix>>, Augmentation<Ipv6Prefix>> augmentation = Collections.emptyMap();
97     
98         Ipv6PrefixImpl(Ipv6PrefixBuilder base) {
99             this._ipv6Prefix = base.getIpv6Prefix();
100             this.augmentation = ImmutableMap.copyOf(base.augmentation);
101         }
102     
103         @Override
104         public Class<Ipv6Prefix> getImplementedInterface() {
105             return Ipv6Prefix.class;
106         }
107     
108         @Override
109         public org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix getIpv6Prefix() {
110             return _ipv6Prefix;
111         }
112         
113         @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"})
114         @Override
115         public <E$$ extends Augmentation<Ipv6Prefix>> E$$ augmentation(Class<E$$> augmentationType) {
116             return (E$$) augmentation.get(CodeHelpers.nonNullValue(augmentationType, "augmentationType"));
117         }
118     
119         private int hash = 0;
120         private volatile boolean hashValid = false;
121         
122         @Override
123         public int hashCode() {
124             if (hashValid) {
125                 return hash;
126             }
127         
128             final int prime = 31;
129             int result = 1;
130             result = prime * result + Objects.hashCode(_ipv6Prefix);
131             result = prime * result + Objects.hashCode(augmentation);
132         
133             hash = result;
134             hashValid = true;
135             return result;
136         }
137     
138         @Override
139         public boolean equals(Object obj) {
140             if (this == obj) {
141                 return true;
142             }
143             if (!(obj instanceof DataObject)) {
144                 return false;
145             }
146             if (!Ipv6Prefix.class.equals(((DataObject)obj).getImplementedInterface())) {
147                 return false;
148             }
149             Ipv6Prefix other = (Ipv6Prefix)obj;
150             if (!Objects.equals(_ipv6Prefix, other.getIpv6Prefix())) {
151                 return false;
152             }
153             if (getClass() == obj.getClass()) {
154                 // Simple case: we are comparing against self
155                 Ipv6PrefixImpl otherImpl = (Ipv6PrefixImpl) obj;
156                 if (!Objects.equals(augmentation, otherImpl.augmentation)) {
157                     return false;
158                 }
159             } else {
160                 // Hard case: compare our augments with presence there...
161                 for (Map.Entry<Class<? extends Augmentation<Ipv6Prefix>>, Augmentation<Ipv6Prefix>> e : augmentation.entrySet()) {
162                     if (!e.getValue().equals(other.augmentation(e.getKey()))) {
163                         return false;
164                     }
165                 }
166                 // .. and give the other one the chance to do the same
167                 if (!obj.equals(this)) {
168                     return false;
169                 }
170             }
171             return true;
172         }
173     
174         @Override
175         public String toString() {
176             final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("Ipv6Prefix");
177             CodeHelpers.appendValue(helper, "_ipv6Prefix", _ipv6Prefix);
178             CodeHelpers.appendValue(helper, "augmentation", augmentation.values());
179             return helper.toString();
180         }
181     }
182 }