1 package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl;
2 import java.util.Collections;
4 import org.opendaylight.yangtools.yang.binding.DataObject;
5 import org.opendaylight.yangtools.yang.binding.AugmentationHolder;
6 import java.util.HashMap;
7 import org.opendaylight.yangtools.concepts.Builder;
8 import org.opendaylight.yangtools.yang.binding.Augmentation;
12 * Class that builds {@link org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry} instances.
14 * @see org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry
17 public class RpcRegistryBuilder implements Builder <org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry> {
19 private java.lang.Object _name;
20 private java.lang.Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> _type;
22 Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry>> augmentation = new HashMap<>();
24 public RpcRegistryBuilder() {
26 public RpcRegistryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef arg) {
27 this._type = arg.getType();
28 this._name = arg.getName();
31 public RpcRegistryBuilder(RpcRegistry base) {
32 this._name = base.getName();
33 this._type = base.getType();
34 if (base instanceof RpcRegistryImpl) {
35 RpcRegistryImpl impl = (RpcRegistryImpl) base;
36 this.augmentation = new HashMap<>(impl.augmentation);
37 } else if (base instanceof AugmentationHolder) {
38 @SuppressWarnings("unchecked")
39 AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry>) base;
40 this.augmentation = new HashMap<>(casted.augmentations());
45 *Set fields from given grouping argument. Valid argument is instance of one of following types:
47 * <li>org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef</li>
50 * @param arg grouping object
51 * @throws IllegalArgumentException if given argument is none of valid types
53 public void fieldsFrom(DataObject arg) {
54 boolean isValidArg = false;
55 if (arg instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef) {
56 this._type = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef)arg).getType();
57 this._name = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef)arg).getName();
61 throw new IllegalArgumentException(
62 "expected one of: [org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef] \n" +
68 public java.lang.Object getName() {
72 public java.lang.Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> getType() {
76 @SuppressWarnings("unchecked")
77 public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry>> E getAugmentation(java.lang.Class<E> augmentationType) {
78 if (augmentationType == null) {
79 throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
81 return (E) augmentation.get(augmentationType);
84 public RpcRegistryBuilder setName(java.lang.Object value) {
89 public RpcRegistryBuilder setType(java.lang.Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> value) {
94 public RpcRegistryBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry> augmentation) {
95 if (augmentation == null) {
96 return removeAugmentation(augmentationType);
98 this.augmentation.put(augmentationType, augmentation);
102 public RpcRegistryBuilder removeAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry>> augmentationType) {
103 this.augmentation.remove(augmentationType);
107 public RpcRegistry build() {
108 return new RpcRegistryImpl(this);
111 private static final class RpcRegistryImpl implements RpcRegistry {
113 public java.lang.Class<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry> getImplementedInterface() {
114 return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry.class;
117 private final java.lang.Object _name;
118 private final java.lang.Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> _type;
120 private Map<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry>> augmentation = new HashMap<>();
122 private RpcRegistryImpl(RpcRegistryBuilder base) {
123 this._name = base.getName();
124 this._type = base.getType();
125 switch (base.augmentation.size()) {
127 this.augmentation = Collections.emptyMap();
130 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.modules.module.configuration.alto.provider.impl.RpcRegistry>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry>> e = base.augmentation.entrySet().iterator().next();
131 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.modules.module.configuration.alto.provider.impl.RpcRegistry>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry>>singletonMap(e.getKey(), e.getValue());
134 this.augmentation = new HashMap<>(base.augmentation);
139 public java.lang.Object getName() {
144 public java.lang.Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceType> getType() {
148 @SuppressWarnings("unchecked")
150 public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry>> E getAugmentation(java.lang.Class<E> augmentationType) {
151 if (augmentationType == null) {
152 throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
154 return (E) augmentation.get(augmentationType);
158 public int hashCode() {
159 final int prime = 31;
161 result = prime * result + ((_name == null) ? 0 : _name.hashCode());
162 result = prime * result + ((_type == null) ? 0 : _type.hashCode());
163 result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode());
168 public boolean equals(java.lang.Object obj) {
172 if (!(obj instanceof DataObject)) {
175 if (!org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry.class.equals(((DataObject)obj).getImplementedInterface())) {
178 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry other = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry)obj;
180 if (other.getName() != null) {
183 } else if(!_name.equals(other.getName())) {
187 if (other.getType() != null) {
190 } else if(!_type.equals(other.getType())) {
193 if (getClass() == obj.getClass()) {
194 // Simple case: we are comparing against self
195 RpcRegistryImpl otherImpl = (RpcRegistryImpl) obj;
196 if (augmentation == null) {
197 if (otherImpl.augmentation != null) {
200 } else if(!augmentation.equals(otherImpl.augmentation)) {
204 // Hard case: compare our augments with presence there...
205 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.modules.module.configuration.alto.provider.impl.RpcRegistry>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.alto.provider.impl.rev141119.modules.module.configuration.alto.provider.impl.RpcRegistry>> e : augmentation.entrySet()) {
206 if (!e.getValue().equals(other.getAugmentation(e.getKey()))) {
210 // .. and give the other one the chance to do the same
211 if (!obj.equals(this)) {
219 public java.lang.String toString() {
220 java.lang.StringBuilder builder = new java.lang.StringBuilder ("RpcRegistry [");
221 boolean first = true;
227 builder.append(", ");
229 builder.append("_name=");
230 builder.append(_name);
236 builder.append(", ");
238 builder.append("_type=");
239 builder.append(_type);
244 builder.append(", ");
246 builder.append("augmentation=");
247 builder.append(augmentation.values());
248 return builder.append(']').toString();