Removing blueprints-processor
[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 / Ipv6AddressBuilder.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 Ipv6AddressBuilder} instances.
21  *
22  * @see Ipv6AddressBuilder
23  *
24  */
25 public class Ipv6AddressBuilder implements Builder<Ipv6Address> {
26
27     private org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address _ipv6Address;
28
29
30     Map<Class<? extends Augmentation<Ipv6Address>>, Augmentation<Ipv6Address>> augmentation = Collections.emptyMap();
31
32     public Ipv6AddressBuilder() {
33     }
34
35     public Ipv6AddressBuilder(Ipv6Address base) {
36         this._ipv6Address = base.getIpv6Address();
37         if (base instanceof Ipv6AddressImpl) {
38             Ipv6AddressImpl impl = (Ipv6AddressImpl) 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<Ipv6Address>>, Augmentation<Ipv6Address>> aug =((AugmentationHolder<Ipv6Address>) 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.Ipv6Address getIpv6Address() {
53         return _ipv6Address;
54     }
55     
56     @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"})
57     public <E$$ extends Augmentation<Ipv6Address>> E$$ augmentation(Class<E$$> augmentationType) {
58         return (E$$) augmentation.get(CodeHelpers.nonNullValue(augmentationType, "augmentationType"));
59     }
60
61     
62     public Ipv6AddressBuilder setIpv6Address(final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address value) {
63         this._ipv6Address = value;
64         return this;
65     }
66     
67     public Ipv6AddressBuilder addAugmentation(Class<? extends Augmentation<Ipv6Address>> augmentationType, Augmentation<Ipv6Address> 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 Ipv6AddressBuilder removeAugmentation(Class<? extends Augmentation<Ipv6Address>> augmentationType) {
81         if (this.augmentation instanceof HashMap) {
82             this.augmentation.remove(augmentationType);
83         }
84         return this;
85     }
86
87     @Override
88     public Ipv6Address build() {
89         return new Ipv6AddressImpl(this);
90     }
91
92     private static final class Ipv6AddressImpl implements Ipv6Address {
93     
94         private final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address _ipv6Address;
95     
96         private Map<Class<? extends Augmentation<Ipv6Address>>, Augmentation<Ipv6Address>> augmentation = Collections.emptyMap();
97     
98         Ipv6AddressImpl(Ipv6AddressBuilder base) {
99             this._ipv6Address = base.getIpv6Address();
100             this.augmentation = ImmutableMap.copyOf(base.augmentation);
101         }
102     
103         @Override
104         public Class<Ipv6Address> getImplementedInterface() {
105             return Ipv6Address.class;
106         }
107     
108         @Override
109         public org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address getIpv6Address() {
110             return _ipv6Address;
111         }
112         
113         @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"})
114         @Override
115         public <E$$ extends Augmentation<Ipv6Address>> 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(_ipv6Address);
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 (!Ipv6Address.class.equals(((DataObject)obj).getImplementedInterface())) {
147                 return false;
148             }
149             Ipv6Address other = (Ipv6Address)obj;
150             if (!Objects.equals(_ipv6Address, other.getIpv6Address())) {
151                 return false;
152             }
153             if (getClass() == obj.getClass()) {
154                 // Simple case: we are comparing against self
155                 Ipv6AddressImpl otherImpl = (Ipv6AddressImpl) 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<Ipv6Address>>, Augmentation<Ipv6Address>> 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("Ipv6Address");
177             CodeHelpers.appendValue(helper, "_ipv6Address", _ipv6Address);
178             CodeHelpers.appendValue(helper, "augmentation", augmentation.values());
179             return helper.toString();
180         }
181     }
182 }