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