1 package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110;
2 import org.opendaylight.yangtools.yang.binding.Augmentation;
3 import org.opendaylight.yangtools.yang.binding.AugmentationHolder;
4 import org.opendaylight.yangtools.yang.binding.DataObject;
5 import java.util.HashMap;
6 import org.opendaylight.yangtools.concepts.Builder;
7 import java.util.Objects;
9 import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult;
10 import java.util.Collections;
14 * Class that builds {@link org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults} instances.
16 * @see org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults
19 public class TestResultsBuilder implements Builder<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults> {
21 private List<TestResult> _testResult;
23 Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>> augmentation = Collections.emptyMap();
25 public TestResultsBuilder() {
28 public TestResultsBuilder(TestResults base) {
29 this._testResult = base.getTestResult();
30 if (base instanceof TestResultsImpl) {
31 TestResultsImpl impl = (TestResultsImpl) base;
32 if (!impl.augmentation.isEmpty()) {
33 this.augmentation = new HashMap<>(impl.augmentation);
35 } else if (base instanceof AugmentationHolder) {
36 @SuppressWarnings("unchecked")
37 AugmentationHolder<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>) base;
38 if (!casted.augmentations().isEmpty()) {
39 this.augmentation = new HashMap<>(casted.augmentations());
45 public List<TestResult> getTestResult() {
49 @SuppressWarnings("unchecked")
50 public <E extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>> E getAugmentation(java.lang.Class<E> augmentationType) {
51 if (augmentationType == null) {
52 throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
54 return (E) augmentation.get(augmentationType);
58 public TestResultsBuilder setTestResult(final List<TestResult> value) {
59 this._testResult = value;
63 public TestResultsBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults> augmentation) {
64 if (augmentation == null) {
65 return removeAugmentation(augmentationType);
68 if (!(this.augmentation instanceof HashMap)) {
69 this.augmentation = new HashMap<>();
72 this.augmentation.put(augmentationType, augmentation);
76 public TestResultsBuilder removeAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>> augmentationType) {
77 if (this.augmentation instanceof HashMap) {
78 this.augmentation.remove(augmentationType);
84 public TestResults build() {
85 return new TestResultsImpl(this);
88 private static final class TestResultsImpl implements TestResults {
91 public java.lang.Class<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults> getImplementedInterface() {
92 return org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults.class;
95 private final List<TestResult> _testResult;
97 private Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>> augmentation = Collections.emptyMap();
99 private TestResultsImpl(TestResultsBuilder base) {
100 this._testResult = base.getTestResult();
101 switch (base.augmentation.size()) {
103 this.augmentation = Collections.emptyMap();
106 final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>> e = base.augmentation.entrySet().iterator().next();
107 this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>>singletonMap(e.getKey(), e.getValue());
110 this.augmentation = new HashMap<>(base.augmentation);
115 public List<TestResult> getTestResult() {
119 @SuppressWarnings("unchecked")
121 public <E extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>> E getAugmentation(java.lang.Class<E> augmentationType) {
122 if (augmentationType == null) {
123 throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
125 return (E) augmentation.get(augmentationType);
128 private int hash = 0;
129 private volatile boolean hashValid = false;
132 public int hashCode() {
137 final int prime = 31;
139 result = prime * result + Objects.hashCode(_testResult);
140 result = prime * result + Objects.hashCode(augmentation);
148 public boolean equals(java.lang.Object obj) {
152 if (!(obj instanceof DataObject)) {
155 if (!org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults.class.equals(((DataObject)obj).getImplementedInterface())) {
158 org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults other = (org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults)obj;
159 if (!Objects.equals(_testResult, other.getTestResult())) {
162 if (getClass() == obj.getClass()) {
163 // Simple case: we are comparing against self
164 TestResultsImpl otherImpl = (TestResultsImpl) obj;
165 if (!Objects.equals(augmentation, otherImpl.augmentation)) {
169 // Hard case: compare our augments with presence there...
170 for (Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults>> e : augmentation.entrySet()) {
171 if (!e.getValue().equals(other.getAugmentation(e.getKey()))) {
175 // .. and give the other one the chance to do the same
176 if (!obj.equals(this)) {
184 public java.lang.String toString() {
185 java.lang.String name = "TestResults [";
186 java.lang.StringBuilder builder = new java.lang.StringBuilder (name);
187 if (_testResult != null) {
188 builder.append("_testResult=");
189 builder.append(_testResult);
191 final int builderLength = builder.length();
192 final int builderAdditionalLength = builder.substring(name.length(), builderLength).length();
193 if (builderAdditionalLength > 2 && !builder.substring(builderLength - 2, builderLength).equals(", ")) {
194 builder.append(", ");
196 builder.append("augmentation=");
197 builder.append(augmentation.values());
198 return builder.append(']').toString();