9f28ef27b038f84f47d6984b68c3f9906f8869d8
[ccsdk/sli.git] /
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 org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.Mode;
8 import java.util.Objects;
9 import java.util.List;
10 import java.util.Collections;
11 import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter;
12 import java.util.Map;
13
14 /**
15  * Class that builds {@link org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput} instances.
16  *
17  * @see org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput
18  *
19  */
20 public class ExecuteGraphInputBuilder implements Builder<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput> {
21
22     private Mode _mode;
23     private java.lang.String _moduleName;
24     private java.lang.String _rpcName;
25     private List<SliParameter> _sliParameter;
26
27     Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>> augmentation = Collections.emptyMap();
28
29     public ExecuteGraphInputBuilder() {
30     }
31
32     public ExecuteGraphInputBuilder(ExecuteGraphInput base) {
33         this._mode = base.getMode();
34         this._moduleName = base.getModuleName();
35         this._rpcName = base.getRpcName();
36         this._sliParameter = base.getSliParameter();
37         if (base instanceof ExecuteGraphInputImpl) {
38             ExecuteGraphInputImpl impl = (ExecuteGraphInputImpl) base;
39             if (!impl.augmentation.isEmpty()) {
40                 this.augmentation = new HashMap<>(impl.augmentation);
41             }
42         } else if (base instanceof AugmentationHolder) {
43             @SuppressWarnings("unchecked")
44             AugmentationHolder<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>) base;
45             if (!casted.augmentations().isEmpty()) {
46                 this.augmentation = new HashMap<>(casted.augmentations());
47             }
48         }
49     }
50
51
52     public Mode getMode() {
53         return _mode;
54     }
55     
56     public java.lang.String getModuleName() {
57         return _moduleName;
58     }
59     
60     public java.lang.String getRpcName() {
61         return _rpcName;
62     }
63     
64     public List<SliParameter> getSliParameter() {
65         return _sliParameter;
66     }
67     
68     @SuppressWarnings("unchecked")
69     public <E extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>> E getAugmentation(java.lang.Class<E> augmentationType) {
70         if (augmentationType == null) {
71             throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
72         }
73         return (E) augmentation.get(augmentationType);
74     }
75
76      
77     public ExecuteGraphInputBuilder setMode(final Mode value) {
78         this._mode = value;
79         return this;
80     }
81     
82      
83     public ExecuteGraphInputBuilder setModuleName(final java.lang.String value) {
84         this._moduleName = value;
85         return this;
86     }
87     
88      
89     public ExecuteGraphInputBuilder setRpcName(final java.lang.String value) {
90         this._rpcName = value;
91         return this;
92     }
93     
94      
95     public ExecuteGraphInputBuilder setSliParameter(final List<SliParameter> value) {
96         this._sliParameter = value;
97         return this;
98     }
99     
100     public ExecuteGraphInputBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput> augmentation) {
101         if (augmentation == null) {
102             return removeAugmentation(augmentationType);
103         }
104     
105         if (!(this.augmentation instanceof HashMap)) {
106             this.augmentation = new HashMap<>();
107         }
108     
109         this.augmentation.put(augmentationType, augmentation);
110         return this;
111     }
112     
113     public ExecuteGraphInputBuilder removeAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>> augmentationType) {
114         if (this.augmentation instanceof HashMap) {
115             this.augmentation.remove(augmentationType);
116         }
117         return this;
118     }
119
120     @Override
121     public ExecuteGraphInput build() {
122         return new ExecuteGraphInputImpl(this);
123     }
124
125     private static final class ExecuteGraphInputImpl implements ExecuteGraphInput {
126
127         @Override
128         public java.lang.Class<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput> getImplementedInterface() {
129             return org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.class;
130         }
131
132         private final Mode _mode;
133         private final java.lang.String _moduleName;
134         private final java.lang.String _rpcName;
135         private final List<SliParameter> _sliParameter;
136
137         private Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>> augmentation = Collections.emptyMap();
138
139         private ExecuteGraphInputImpl(ExecuteGraphInputBuilder base) {
140             this._mode = base.getMode();
141             this._moduleName = base.getModuleName();
142             this._rpcName = base.getRpcName();
143             this._sliParameter = base.getSliParameter();
144             switch (base.augmentation.size()) {
145             case 0:
146                 this.augmentation = Collections.emptyMap();
147                 break;
148             case 1:
149                 final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>> e = base.augmentation.entrySet().iterator().next();
150                 this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>>singletonMap(e.getKey(), e.getValue());
151                 break;
152             default :
153                 this.augmentation = new HashMap<>(base.augmentation);
154             }
155         }
156
157         @Override
158         public Mode getMode() {
159             return _mode;
160         }
161         
162         @Override
163         public java.lang.String getModuleName() {
164             return _moduleName;
165         }
166         
167         @Override
168         public java.lang.String getRpcName() {
169             return _rpcName;
170         }
171         
172         @Override
173         public List<SliParameter> getSliParameter() {
174             return _sliParameter;
175         }
176         
177         @SuppressWarnings("unchecked")
178         @Override
179         public <E extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>> E getAugmentation(java.lang.Class<E> augmentationType) {
180             if (augmentationType == null) {
181                 throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
182             }
183             return (E) augmentation.get(augmentationType);
184         }
185
186         private int hash = 0;
187         private volatile boolean hashValid = false;
188         
189         @Override
190         public int hashCode() {
191             if (hashValid) {
192                 return hash;
193             }
194         
195             final int prime = 31;
196             int result = 1;
197             result = prime * result + Objects.hashCode(_mode);
198             result = prime * result + Objects.hashCode(_moduleName);
199             result = prime * result + Objects.hashCode(_rpcName);
200             result = prime * result + Objects.hashCode(_sliParameter);
201             result = prime * result + Objects.hashCode(augmentation);
202         
203             hash = result;
204             hashValid = true;
205             return result;
206         }
207
208         @Override
209         public boolean equals(java.lang.Object obj) {
210             if (this == obj) {
211                 return true;
212             }
213             if (!(obj instanceof DataObject)) {
214                 return false;
215             }
216             if (!org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.class.equals(((DataObject)obj).getImplementedInterface())) {
217                 return false;
218             }
219             org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput other = (org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput)obj;
220             if (!Objects.equals(_mode, other.getMode())) {
221                 return false;
222             }
223             if (!Objects.equals(_moduleName, other.getModuleName())) {
224                 return false;
225             }
226             if (!Objects.equals(_rpcName, other.getRpcName())) {
227                 return false;
228             }
229             if (!Objects.equals(_sliParameter, other.getSliParameter())) {
230                 return false;
231             }
232             if (getClass() == obj.getClass()) {
233                 // Simple case: we are comparing against self
234                 ExecuteGraphInputImpl otherImpl = (ExecuteGraphInputImpl) obj;
235                 if (!Objects.equals(augmentation, otherImpl.augmentation)) {
236                     return false;
237                 }
238             } else {
239                 // Hard case: compare our augments with presence there...
240                 for (Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>>, Augmentation<org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput>> e : augmentation.entrySet()) {
241                     if (!e.getValue().equals(other.getAugmentation(e.getKey()))) {
242                         return false;
243                     }
244                 }
245                 // .. and give the other one the chance to do the same
246                 if (!obj.equals(this)) {
247                     return false;
248                 }
249             }
250             return true;
251         }
252
253         @Override
254         public java.lang.String toString() {
255             java.lang.String name = "ExecuteGraphInput [";
256             java.lang.StringBuilder builder = new java.lang.StringBuilder (name);
257             if (_mode != null) {
258                 builder.append("_mode=");
259                 builder.append(_mode);
260                 builder.append(", ");
261             }
262             if (_moduleName != null) {
263                 builder.append("_moduleName=");
264                 builder.append(_moduleName);
265                 builder.append(", ");
266             }
267             if (_rpcName != null) {
268                 builder.append("_rpcName=");
269                 builder.append(_rpcName);
270                 builder.append(", ");
271             }
272             if (_sliParameter != null) {
273                 builder.append("_sliParameter=");
274                 builder.append(_sliParameter);
275             }
276             final int builderLength = builder.length();
277             final int builderAdditionalLength = builder.substring(name.length(), builderLength).length();
278             if (builderAdditionalLength > 2 && !builder.substring(builderLength - 2, builderLength).equals(", ")) {
279                 builder.append(", ");
280             }
281             builder.append("augmentation=");
282             builder.append(augmentation.values());
283             return builder.append(']').toString();
284         }
285     }
286
287 }