diff options
Diffstat (limited to 'sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/test/results/TestResultBuilder.java')
-rw-r--r-- | sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/test/results/TestResultBuilder.java | 271 |
1 files changed, 271 insertions, 0 deletions
diff --git a/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/test/results/TestResultBuilder.java b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/test/results/TestResultBuilder.java new file mode 100644 index 00000000..51e43722 --- /dev/null +++ b/sli/model/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/org/onap/ccsdk/sli/core/sliapi/rev161110/test/results/TestResultBuilder.java @@ -0,0 +1,271 @@ +package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results; +import org.opendaylight.yangtools.yang.binding.Augmentation; +import org.opendaylight.yangtools.yang.binding.AugmentationHolder; +import org.opendaylight.yangtools.yang.binding.DataObject; +import java.util.HashMap; +import org.opendaylight.yangtools.concepts.Builder; +import java.util.Objects; +import java.util.List; +import java.util.Collections; +import java.util.Map; + +/** + * Class that builds {@link org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult} instances. + * + * @see org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult + * + */ +public class TestResultBuilder implements Builder<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult> { + + private TestResultKey _key; + private List<java.lang.String> _results; + private java.lang.String _testIdentifier; + + Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>> augmentation = Collections.emptyMap(); + + public TestResultBuilder() { + } + + public TestResultBuilder(TestResult base) { + if (base.getKey() == null) { + this._key = new TestResultKey( + base.getTestIdentifier() + ); + this._testIdentifier = base.getTestIdentifier(); + } else { + this._key = base.getKey(); + this._testIdentifier = _key.getTestIdentifier(); + } + this._results = base.getResults(); + if (base instanceof TestResultImpl) { + TestResultImpl impl = (TestResultImpl) base; + if (!impl.augmentation.isEmpty()) { + this.augmentation = new HashMap<>(impl.augmentation); + } + } else if (base instanceof AugmentationHolder) { + @SuppressWarnings("unchecked") + AugmentationHolder<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>) base; + if (!casted.augmentations().isEmpty()) { + this.augmentation = new HashMap<>(casted.augmentations()); + } + } + } + + + public TestResultKey getKey() { + return _key; + } + + public List<java.lang.String> getResults() { + return _results; + } + + public java.lang.String getTestIdentifier() { + return _testIdentifier; + } + + @SuppressWarnings("unchecked") + public <E extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>> E getAugmentation(java.lang.Class<E> augmentationType) { + if (augmentationType == null) { + throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!"); + } + return (E) augmentation.get(augmentationType); + } + + + public TestResultBuilder setKey(final TestResultKey value) { + this._key = value; + return this; + } + + + public TestResultBuilder setResults(final List<java.lang.String> value) { + this._results = value; + return this; + } + + + public TestResultBuilder setTestIdentifier(final java.lang.String value) { + this._testIdentifier = value; + return this; + } + + public TestResultBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult> augmentation) { + if (augmentation == null) { + return removeAugmentation(augmentationType); + } + + if (!(this.augmentation instanceof HashMap)) { + this.augmentation = new HashMap<>(); + } + + this.augmentation.put(augmentationType, augmentation); + return this; + } + + public TestResultBuilder removeAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>> augmentationType) { + if (this.augmentation instanceof HashMap) { + this.augmentation.remove(augmentationType); + } + return this; + } + + @Override + public TestResult build() { + return new TestResultImpl(this); + } + + private static final class TestResultImpl implements TestResult { + + @Override + public java.lang.Class<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult> getImplementedInterface() { + return org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult.class; + } + + private final TestResultKey _key; + private final List<java.lang.String> _results; + private final java.lang.String _testIdentifier; + + private Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>> augmentation = Collections.emptyMap(); + + private TestResultImpl(TestResultBuilder base) { + if (base.getKey() == null) { + this._key = new TestResultKey( + base.getTestIdentifier() + ); + this._testIdentifier = base.getTestIdentifier(); + } else { + this._key = base.getKey(); + this._testIdentifier = _key.getTestIdentifier(); + } + this._results = base.getResults(); + switch (base.augmentation.size()) { + case 0: + this.augmentation = Collections.emptyMap(); + break; + case 1: + final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>> e = base.augmentation.entrySet().iterator().next(); + this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>>singletonMap(e.getKey(), e.getValue()); + break; + default : + this.augmentation = new HashMap<>(base.augmentation); + } + } + + @Override + public TestResultKey getKey() { + return _key; + } + + @Override + public List<java.lang.String> getResults() { + return _results; + } + + @Override + public java.lang.String getTestIdentifier() { + return _testIdentifier; + } + + @SuppressWarnings("unchecked") + @Override + public <E extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>> E getAugmentation(java.lang.Class<E> augmentationType) { + if (augmentationType == null) { + throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!"); + } + return (E) augmentation.get(augmentationType); + } + + private int hash = 0; + private volatile boolean hashValid = false; + + @Override + public int hashCode() { + if (hashValid) { + return hash; + } + + final int prime = 31; + int result = 1; + result = prime * result + Objects.hashCode(_key); + result = prime * result + Objects.hashCode(_results); + result = prime * result + Objects.hashCode(_testIdentifier); + result = prime * result + Objects.hashCode(augmentation); + + hash = result; + hashValid = true; + return result; + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof DataObject)) { + return false; + } + if (!org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult.class.equals(((DataObject)obj).getImplementedInterface())) { + return false; + } + org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult other = (org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult)obj; + if (!Objects.equals(_key, other.getKey())) { + return false; + } + if (!Objects.equals(_results, other.getResults())) { + return false; + } + if (!Objects.equals(_testIdentifier, other.getTestIdentifier())) { + return false; + } + if (getClass() == obj.getClass()) { + // Simple case: we are comparing against self + TestResultImpl otherImpl = (TestResultImpl) obj; + if (!Objects.equals(augmentation, otherImpl.augmentation)) { + return false; + } + } else { + // Hard case: compare our augments with presence there... + for (Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult>> e : augmentation.entrySet()) { + if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { + return false; + } + } + // .. and give the other one the chance to do the same + if (!obj.equals(this)) { + return false; + } + } + return true; + } + + @Override + public java.lang.String toString() { + java.lang.String name = "TestResult ["; + java.lang.StringBuilder builder = new java.lang.StringBuilder (name); + if (_key != null) { + builder.append("_key="); + builder.append(_key); + builder.append(", "); + } + if (_results != null) { + builder.append("_results="); + builder.append(_results); + builder.append(", "); + } + if (_testIdentifier != null) { + builder.append("_testIdentifier="); + builder.append(_testIdentifier); + } + final int builderLength = builder.length(); + final int builderAdditionalLength = builder.substring(name.length(), builderLength).length(); + if (builderAdditionalLength > 2 && !builder.substring(builderLength - 2, builderLength).equals(", ")) { + builder.append(", "); + } + builder.append("augmentation="); + builder.append(augmentation.values()); + return builder.append(']').toString(); + } + } + +} |