1 package org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group;
2 import org.opendaylight.yangtools.yang.binding.Augmentation;
3 import org.opendaylight.yangtools.yang.binding.AugmentationHolder;
4 import org.opendaylight.yangtools.yang.binding.TreeNode;
5 import java.util.HashMap;
6 import org.opendaylight.yangtools.concepts.Builder;
7 import java.util.Objects;
8 import java.util.Collections;
13 * Class that builds {@link org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont} instances.
15 * @see org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont
18 public class SecondGroupContBuilder implements Builder <org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont> {
20 private java.lang.String _secondGroupContLeaf;
22 Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont>>, Augmentation<org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont>> augmentation = Collections.emptyMap();
24 public SecondGroupContBuilder() {
27 public SecondGroupContBuilder(SecondGroupCont base) {
28 this._secondGroupContLeaf = base.getSecondGroupContLeaf();
29 if (base instanceof SecondGroupContImpl) {
30 SecondGroupContImpl impl = (SecondGroupContImpl) base;
31 if (!impl.augmentation.isEmpty()) {
32 this.augmentation = new HashMap<>(impl.augmentation);
34 } else if (base instanceof AugmentationHolder) {
35 @SuppressWarnings("unchecked")
36 AugmentationHolder<org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont>) base;
37 if (!casted.augmentations().isEmpty()) {
38 this.augmentation = new HashMap<>(casted.augmentations());
44 public java.lang.String getSecondGroupContLeaf() {
45 return _secondGroupContLeaf;
48 @SuppressWarnings("unchecked")
49 public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont>> E getAugmentation(java.lang.Class<E> augmentationType) {
50 if (augmentationType == null) {
51 throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
53 return (E) augmentation.get(augmentationType);
57 public SecondGroupContBuilder setSecondGroupContLeaf(final java.lang.String value) {
58 this._secondGroupContLeaf = value;
62 public SecondGroupContBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont> augmentation) {
63 if (augmentation == null) {
64 return removeAugmentation(augmentationType);
67 if (!(this.augmentation instanceof HashMap)) {
68 this.augmentation = new HashMap<>();
71 this.augmentation.put(augmentationType, augmentation);
75 public SecondGroupContBuilder removeAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont>> augmentationType) {
76 if (this.augmentation instanceof HashMap) {
77 this.augmentation.remove(augmentationType);
82 public SecondGroupCont build() {
83 return new SecondGroupContImpl(this);
86 private static final class SecondGroupContImpl implements SecondGroupCont {
88 public java.lang.Class<org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont> implementedInterface() {
89 return org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont.class;
92 private final java.lang.String _secondGroupContLeaf;
94 private Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont>>, Augmentation<org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont>> augmentation = Collections.emptyMap();
96 private SecondGroupContImpl(SecondGroupContBuilder base) {
97 this._secondGroupContLeaf = base.getSecondGroupContLeaf();
98 switch (base.augmentation.size()) {
100 this.augmentation = Collections.emptyMap();
103 final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont>>, Augmentation<org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont>> e = base.augmentation.entrySet().iterator().next();
104 this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont>>, Augmentation<org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont>>singletonMap(e.getKey(), e.getValue());
107 this.augmentation = new HashMap<>(base.augmentation);
112 public java.lang.String getSecondGroupContLeaf() {
113 return _secondGroupContLeaf;
116 @SuppressWarnings("unchecked")
118 public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont>> E getAugmentation(java.lang.Class<E> augmentationType) {
119 if (augmentationType == null) {
120 throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
122 return (E) augmentation.get(augmentationType);
125 private int hash = 0;
126 private volatile boolean hashValid = false;
129 public int hashCode() {
134 final int prime = 31;
136 result = prime * result + Objects.hashCode(_secondGroupContLeaf);
137 result = prime * result + Objects.hashCode(augmentation);
145 public boolean equals(java.lang.Object obj) {
149 if (!(obj instanceof TreeNode)) {
152 if (!org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont.class.equals(((TreeNode)obj).implementedInterface())) {
155 org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont other = (org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont)obj;
156 if (!Objects.equals(_secondGroupContLeaf, other.getSecondGroupContLeaf())) {
159 if (getClass() == obj.getClass()) {
160 // Simple case: we are comparing against self
161 SecondGroupContImpl otherImpl = (SecondGroupContImpl) obj;
162 if (!Objects.equals(augmentation, otherImpl.augmentation)) {
166 // Hard case: compare our augments with presence there...
167 for (Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont>>, Augmentation<org.opendaylight.yang.gen.v1.urn.test.mainyangtest.grp.second.group.SecondGroupCont>> e : augmentation.entrySet()) {
168 if (!e.getValue().equals(other.getAugmentation(e.getKey()))) {
172 // .. and give the other one the chance to do the same
173 if (!obj.equals(this)) {
181 public java.lang.String toString() {
182 java.lang.StringBuilder builder = new java.lang.StringBuilder ("SecondGroupCont [");
183 boolean first = true;
185 if (_secondGroupContLeaf != null) {
189 builder.append(", ");
191 builder.append("_secondGroupContLeaf=");
192 builder.append(_secondGroupContLeaf);
197 builder.append(", ");
199 builder.append("augmentation=");
200 builder.append(augmentation.values());
201 return builder.append(']').toString();