1 package org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input;
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;
8 import java.util.Collections;
12 * Class that builds {@link org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter} instances.
14 * @see org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter
17 public class SliParameterBuilder implements Builder<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter> {
19 private java.lang.Integer _intValue;
20 private SliParameterKey _key;
21 private java.lang.String _parameterName;
22 private java.lang.String _stringValue;
23 private java.lang.Boolean _booleanValue;
25 Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>> augmentation = Collections.emptyMap();
27 public SliParameterBuilder() {
29 public SliParameterBuilder(org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ParameterSetting arg) {
30 this._parameterName = arg.getParameterName();
31 this._intValue = arg.getIntValue();
32 this._stringValue = arg.getStringValue();
33 this._booleanValue = arg.isBooleanValue();
36 public SliParameterBuilder(SliParameter base) {
37 if (base.getKey() == null) {
38 this._key = new SliParameterKey(
39 base.getParameterName()
41 this._parameterName = base.getParameterName();
43 this._key = base.getKey();
44 this._parameterName = _key.getParameterName();
46 this._intValue = base.getIntValue();
47 this._stringValue = base.getStringValue();
48 this._booleanValue = base.isBooleanValue();
49 if (base instanceof SliParameterImpl) {
50 SliParameterImpl impl = (SliParameterImpl) base;
51 if (!impl.augmentation.isEmpty()) {
52 this.augmentation = new HashMap<>(impl.augmentation);
54 } else if (base instanceof AugmentationHolder) {
55 @SuppressWarnings("unchecked")
56 AugmentationHolder<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>) base;
57 if (!casted.augmentations().isEmpty()) {
58 this.augmentation = new HashMap<>(casted.augmentations());
64 *Set fields from given grouping argument. Valid argument is instance of one of following types:
66 * <li>org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ParameterSetting</li>
69 * @param arg grouping object
70 * @throws IllegalArgumentException if given argument is none of valid types
72 public void fieldsFrom(DataObject arg) {
73 boolean isValidArg = false;
74 if (arg instanceof org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ParameterSetting) {
75 this._parameterName = ((org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ParameterSetting)arg).getParameterName();
76 this._intValue = ((org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ParameterSetting)arg).getIntValue();
77 this._stringValue = ((org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ParameterSetting)arg).getStringValue();
78 this._booleanValue = ((org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ParameterSetting)arg).isBooleanValue();
82 throw new IllegalArgumentException(
83 "expected one of: [org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ParameterSetting] \n" +
89 public java.lang.Integer getIntValue() {
93 public SliParameterKey getKey() {
97 public java.lang.String getParameterName() {
98 return _parameterName;
101 public java.lang.String getStringValue() {
105 public java.lang.Boolean isBooleanValue() {
106 return _booleanValue;
109 @SuppressWarnings("unchecked")
110 public <E extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>> E getAugmentation(java.lang.Class<E> augmentationType) {
111 if (augmentationType == null) {
112 throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
114 return (E) augmentation.get(augmentationType);
118 public SliParameterBuilder setIntValue(final java.lang.Integer value) {
119 this._intValue = value;
124 public SliParameterBuilder setKey(final SliParameterKey value) {
130 public SliParameterBuilder setParameterName(final java.lang.String value) {
131 this._parameterName = value;
136 public SliParameterBuilder setStringValue(final java.lang.String value) {
137 this._stringValue = value;
142 public SliParameterBuilder setBooleanValue(final java.lang.Boolean value) {
143 this._booleanValue = value;
147 public SliParameterBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter> augmentation) {
148 if (augmentation == null) {
149 return removeAugmentation(augmentationType);
152 if (!(this.augmentation instanceof HashMap)) {
153 this.augmentation = new HashMap<>();
156 this.augmentation.put(augmentationType, augmentation);
160 public SliParameterBuilder removeAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>> augmentationType) {
161 if (this.augmentation instanceof HashMap) {
162 this.augmentation.remove(augmentationType);
168 public SliParameter build() {
169 return new SliParameterImpl(this);
172 private static final class SliParameterImpl implements SliParameter {
175 public java.lang.Class<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter> getImplementedInterface() {
176 return org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter.class;
179 private final java.lang.Integer _intValue;
180 private final SliParameterKey _key;
181 private final java.lang.String _parameterName;
182 private final java.lang.String _stringValue;
183 private final java.lang.Boolean _booleanValue;
185 private Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>> augmentation = Collections.emptyMap();
187 private SliParameterImpl(SliParameterBuilder base) {
188 if (base.getKey() == null) {
189 this._key = new SliParameterKey(
190 base.getParameterName()
192 this._parameterName = base.getParameterName();
194 this._key = base.getKey();
195 this._parameterName = _key.getParameterName();
197 this._intValue = base.getIntValue();
198 this._stringValue = base.getStringValue();
199 this._booleanValue = base.isBooleanValue();
200 switch (base.augmentation.size()) {
202 this.augmentation = Collections.emptyMap();
205 final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>> e = base.augmentation.entrySet().iterator().next();
206 this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>>singletonMap(e.getKey(), e.getValue());
209 this.augmentation = new HashMap<>(base.augmentation);
214 public java.lang.Integer getIntValue() {
219 public SliParameterKey getKey() {
224 public java.lang.String getParameterName() {
225 return _parameterName;
229 public java.lang.String getStringValue() {
234 public java.lang.Boolean isBooleanValue() {
235 return _booleanValue;
238 @SuppressWarnings("unchecked")
240 public <E extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>> E getAugmentation(java.lang.Class<E> augmentationType) {
241 if (augmentationType == null) {
242 throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
244 return (E) augmentation.get(augmentationType);
247 private int hash = 0;
248 private volatile boolean hashValid = false;
251 public int hashCode() {
256 final int prime = 31;
258 result = prime * result + Objects.hashCode(_intValue);
259 result = prime * result + Objects.hashCode(_key);
260 result = prime * result + Objects.hashCode(_parameterName);
261 result = prime * result + Objects.hashCode(_stringValue);
262 result = prime * result + Objects.hashCode(_booleanValue);
263 result = prime * result + Objects.hashCode(augmentation);
271 public boolean equals(java.lang.Object obj) {
275 if (!(obj instanceof DataObject)) {
278 if (!org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter.class.equals(((DataObject)obj).getImplementedInterface())) {
281 org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter other = (org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter)obj;
282 if (!Objects.equals(_intValue, other.getIntValue())) {
285 if (!Objects.equals(_key, other.getKey())) {
288 if (!Objects.equals(_parameterName, other.getParameterName())) {
291 if (!Objects.equals(_stringValue, other.getStringValue())) {
294 if (!Objects.equals(_booleanValue, other.isBooleanValue())) {
297 if (getClass() == obj.getClass()) {
298 // Simple case: we are comparing against self
299 SliParameterImpl otherImpl = (SliParameterImpl) obj;
300 if (!Objects.equals(augmentation, otherImpl.augmentation)) {
304 // Hard case: compare our augments with presence there...
305 for (Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter>> e : augmentation.entrySet()) {
306 if (!e.getValue().equals(other.getAugmentation(e.getKey()))) {
310 // .. and give the other one the chance to do the same
311 if (!obj.equals(this)) {
319 public java.lang.String toString() {
320 java.lang.String name = "SliParameter [";
321 java.lang.StringBuilder builder = new java.lang.StringBuilder (name);
322 if (_intValue != null) {
323 builder.append("_intValue=");
324 builder.append(_intValue);
325 builder.append(", ");
328 builder.append("_key=");
329 builder.append(_key);
330 builder.append(", ");
332 if (_parameterName != null) {
333 builder.append("_parameterName=");
334 builder.append(_parameterName);
335 builder.append(", ");
337 if (_stringValue != null) {
338 builder.append("_stringValue=");
339 builder.append(_stringValue);
340 builder.append(", ");
342 if (_booleanValue != null) {
343 builder.append("_booleanValue=");
344 builder.append(_booleanValue);
346 final int builderLength = builder.length();
347 final int builderAdditionalLength = builder.substring(name.length(), builderLength).length();
348 if (builderAdditionalLength > 2 && !builder.substring(builderLength - 2, builderLength).equals(", ")) {
349 builder.append(", ");
351 builder.append("augmentation=");
352 builder.append(augmentation.values());
353 return builder.append(']').toString();