Remove old revision
[alto.git] / alto-provider / src / main / yang-gen-sal / org / opendaylight / yang / gen / v1 / urn / opendaylight / params / xml / ns / yang / controller / config / alto / provider / impl / rev141119 / ClearToastsMadeInputBuilder.java
1 package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119;
2 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
3 import java.util.Collections;
4 import java.util.Map;
5 import org.opendaylight.yangtools.yang.binding.DataObject;
6 import java.util.HashMap;
7 import org.opendaylight.yangtools.concepts.Builder;
8 import org.opendaylight.yangtools.yang.binding.Augmentation;
9
10
11 /**
12  * Class that builds {@link org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput} instances.
13  *
14  * @see org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput
15  *
16  */
17 public class ClearToastsMadeInputBuilder implements Builder <org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput> {
18
19     private InstanceIdentifier<?> _contextInstance;
20
21     Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput>> augmentation = new HashMap<>();
22
23     public ClearToastsMadeInputBuilder() {
24     }
25     public ClearToastsMadeInputBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.rpc.context.rev130617.RpcContextRef arg) {
26         this._contextInstance = arg.getContextInstance();
27     }
28
29     public ClearToastsMadeInputBuilder(ClearToastsMadeInput base) {
30         this._contextInstance = base.getContextInstance();
31         if (base instanceof ClearToastsMadeInputImpl) {
32             ClearToastsMadeInputImpl _impl = (ClearToastsMadeInputImpl) base;
33             this.augmentation = new HashMap<>(_impl.augmentation);
34         }
35     }
36
37     /**
38      *Set fields from given grouping argument. Valid argument is instance of one of following types:
39      * <ul>
40      * <li>org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.rpc.context.rev130617.RpcContextRef</li>
41      * </ul>
42      *
43      * @param arg grouping object
44      * @throws IllegalArgumentException if given argument is none of valid types
45     */
46     public void fieldsFrom(DataObject arg) {
47         boolean isValidArg = false;
48         if (arg instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.rpc.context.rev130617.RpcContextRef) {
49             this._contextInstance = ((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.rpc.context.rev130617.RpcContextRef)arg).getContextInstance();
50             isValidArg = true;
51         }
52         if (!isValidArg) {
53             throw new IllegalArgumentException(
54               "expected one of: [org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.rpc.context.rev130617.RpcContextRef] \n" +
55               "but was: " + arg
56             );
57         }
58     }
59
60     public InstanceIdentifier<?> getContextInstance() {
61         return _contextInstance;
62     }
63     
64     @SuppressWarnings("unchecked")
65     public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput>> E getAugmentation(java.lang.Class<E> augmentationType) {
66         if (augmentationType == null) {
67             throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
68         }
69         return (E) augmentation.get(augmentationType);
70     }
71
72     public ClearToastsMadeInputBuilder setContextInstance(InstanceIdentifier<?> value) {
73         this._contextInstance = value;
74         return this;
75     }
76     
77     public ClearToastsMadeInputBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput> augmentation) {
78         if (augmentation == null) {
79             return removeAugmentation(augmentationType);
80         }
81         this.augmentation.put(augmentationType, augmentation);
82         return this;
83     }
84     
85     public ClearToastsMadeInputBuilder removeAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput>> augmentationType) {
86         this.augmentation.remove(augmentationType);
87         return this;
88     }
89
90     public ClearToastsMadeInput build() {
91         return new ClearToastsMadeInputImpl(this);
92     }
93
94     private static final class ClearToastsMadeInputImpl implements ClearToastsMadeInput {
95
96         public java.lang.Class<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput> getImplementedInterface() {
97             return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput.class;
98         }
99
100         private final InstanceIdentifier<?> _contextInstance;
101
102         private Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput>> augmentation = new HashMap<>();
103
104         private ClearToastsMadeInputImpl(ClearToastsMadeInputBuilder base) {
105             this._contextInstance = base.getContextInstance();
106                 switch (base.augmentation.size()) {
107                 case 0:
108                     this.augmentation = Collections.emptyMap();
109                     break;
110                     case 1:
111                         final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput>> e = base.augmentation.entrySet().iterator().next();
112                         this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput>>singletonMap(e.getKey(), e.getValue());
113                     break;
114                 default :
115                     this.augmentation = new HashMap<>(base.augmentation);
116                 }
117         }
118
119         @Override
120         public InstanceIdentifier<?> getContextInstance() {
121             return _contextInstance;
122         }
123         
124         @SuppressWarnings("unchecked")
125         @Override
126         public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput>> E getAugmentation(java.lang.Class<E> augmentationType) {
127             if (augmentationType == null) {
128                 throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
129             }
130             return (E) augmentation.get(augmentationType);
131         }
132
133         @Override
134         public int hashCode() {
135             final int prime = 31;
136             int result = 1;
137             result = prime * result + ((_contextInstance == null) ? 0 : _contextInstance.hashCode());
138             result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode());
139             return result;
140         }
141
142         @Override
143         public boolean equals(java.lang.Object obj) {
144             if (this == obj) {
145                 return true;
146             }
147             if (!(obj instanceof DataObject)) {
148                 return false;
149             }
150             if (!org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput.class.equals(((DataObject)obj).getImplementedInterface())) {
151                 return false;
152             }
153             org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput other = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput)obj;
154             if (_contextInstance == null) {
155                 if (other.getContextInstance() != null) {
156                     return false;
157                 }
158             } else if(!_contextInstance.equals(other.getContextInstance())) {
159                 return false;
160             }
161             if (getClass() == obj.getClass()) {
162                 // Simple case: we are comparing against self
163                 ClearToastsMadeInputImpl otherImpl = (ClearToastsMadeInputImpl) obj;
164                 if (augmentation == null) {
165                     if (otherImpl.augmentation != null) {
166                         return false;
167                     }
168                 } else if(!augmentation.equals(otherImpl.augmentation)) {
169                     return false;
170                 }
171             } else {
172                 // Hard case: compare our augments with presence there...
173                 for (Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.ClearToastsMadeInput>> e : augmentation.entrySet()) {
174                     if (!e.getValue().equals(other.getAugmentation(e.getKey()))) {
175                         return false;
176                     }
177                 }
178                 // .. and give the other one the chance to do the same
179                 if (!obj.equals(this)) {
180                     return false;
181                 }
182             }
183             return true;
184         }
185
186         @Override
187         public java.lang.String toString() {
188             java.lang.StringBuilder builder = new java.lang.StringBuilder ("ClearToastsMadeInput [");
189             boolean first = true;
190         
191             if (_contextInstance != null) {
192                 if (first) {
193                     first = false;
194                 } else {
195                     builder.append(", ");
196                 }
197                 builder.append("_contextInstance=");
198                 builder.append(_contextInstance);
199              }
200             if (first) {
201                 first = false;
202             } else {
203                 builder.append(", ");
204             }
205             builder.append("augmentation=");
206             builder.append(augmentation.values());
207             return builder.append(']').toString();
208         }
209     }
210
211 }