summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager-gran/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/_3gpp/tsg/sa5/nrm/types/rev180731/guami/AmfIdBuilder.java
blob: 03348babe8680c30e845126aa473cf398966e27c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
package org.opendaylight.yang.gen.v1.urn._3gpp.tsg.sa5.nrm.types.rev180731.guami;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableMap;
import java.lang.Class;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.opendaylight.yang.gen.v1.urn._3gpp.tsg.sa5.nrm.types.rev180731.TAMFPointer;
import org.opendaylight.yang.gen.v1.urn._3gpp.tsg.sa5.nrm.types.rev180731.TAMFRegionId;
import org.opendaylight.yang.gen.v1.urn._3gpp.tsg.sa5.nrm.types.rev180731.TAMFSetId;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.Augmentation;
import org.opendaylight.yangtools.yang.binding.AugmentationHolder;
import org.opendaylight.yangtools.yang.binding.CodeHelpers;
import org.opendaylight.yangtools.yang.binding.DataObject;

/**
 * Class that builds {@link AmfIdBuilder} instances.
 *
 * @see AmfIdBuilder
 *
 */
public class AmfIdBuilder implements Builder<AmfId> {

    private TAMFPointer _aMFPointer;
    private TAMFRegionId _aMFRegionId;
    private TAMFSetId _aMFSetId;


    Map<Class<? extends Augmentation<AmfId>>, Augmentation<AmfId>> augmentation = Collections.emptyMap();

    public AmfIdBuilder() {
    }
    public AmfIdBuilder(org.opendaylight.yang.gen.v1.urn._3gpp.tsg.sa5.nrm.types.rev180731.AMFIdentifier arg) {
        this._aMFRegionId = arg.getAMFRegionId();
        this._aMFSetId = arg.getAMFSetId();
        this._aMFPointer = arg.getAMFPointer();
    }

    public AmfIdBuilder(AmfId base) {
        this._aMFPointer = base.getAMFPointer();
        this._aMFRegionId = base.getAMFRegionId();
        this._aMFSetId = base.getAMFSetId();
        if (base instanceof AmfIdImpl) {
            AmfIdImpl impl = (AmfIdImpl) base;
            if (!impl.augmentation.isEmpty()) {
                this.augmentation = new HashMap<>(impl.augmentation);
            }
        } else if (base instanceof AugmentationHolder) {
            @SuppressWarnings("unchecked")
            Map<Class<? extends Augmentation<AmfId>>, Augmentation<AmfId>> aug =((AugmentationHolder<AmfId>) base).augmentations();
            if (!aug.isEmpty()) {
                this.augmentation = new HashMap<>(aug);
            }
        }
    }

    /**
     * Set fields from given grouping argument. Valid argument is instance of one of following types:
     * <ul>
     * <li>org.opendaylight.yang.gen.v1.urn._3gpp.tsg.sa5.nrm.types.rev180731.AMFIdentifier</li>
     * </ul>
     *
     * @param arg grouping object
     * @throws IllegalArgumentException if given argument is none of valid types
    */
    public void fieldsFrom(DataObject arg) {
        boolean isValidArg = false;
        if (arg instanceof org.opendaylight.yang.gen.v1.urn._3gpp.tsg.sa5.nrm.types.rev180731.AMFIdentifier) {
            this._aMFRegionId = ((org.opendaylight.yang.gen.v1.urn._3gpp.tsg.sa5.nrm.types.rev180731.AMFIdentifier)arg).getAMFRegionId();
            this._aMFSetId = ((org.opendaylight.yang.gen.v1.urn._3gpp.tsg.sa5.nrm.types.rev180731.AMFIdentifier)arg).getAMFSetId();
            this._aMFPointer = ((org.opendaylight.yang.gen.v1.urn._3gpp.tsg.sa5.nrm.types.rev180731.AMFIdentifier)arg).getAMFPointer();
            isValidArg = true;
        }
        CodeHelpers.validValue(isValidArg, arg, "[org.opendaylight.yang.gen.v1.urn._3gpp.tsg.sa5.nrm.types.rev180731.AMFIdentifier]");
    }

    public TAMFPointer getAMFPointer() {
        return _aMFPointer;
    }
    
    public TAMFRegionId getAMFRegionId() {
        return _aMFRegionId;
    }
    
    public TAMFSetId getAMFSetId() {
        return _aMFSetId;
    }
    
    @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"})
    public <E$$ extends Augmentation<AmfId>> E$$ augmentation(Class<E$$> augmentationType) {
        return (E$$) augmentation.get(CodeHelpers.nonNullValue(augmentationType, "augmentationType"));
    }

    
    public AmfIdBuilder setAMFPointer(final TAMFPointer value) {
        this._aMFPointer = value;
        return this;
    }
    
    public AmfIdBuilder setAMFRegionId(final TAMFRegionId value) {
        this._aMFRegionId = value;
        return this;
    }
    
    public AmfIdBuilder setAMFSetId(final TAMFSetId value) {
        this._aMFSetId = value;
        return this;
    }
    
    public AmfIdBuilder addAugmentation(Class<? extends Augmentation<AmfId>> augmentationType, Augmentation<AmfId> augmentationValue) {
        if (augmentationValue == null) {
            return removeAugmentation(augmentationType);
        }
    
        if (!(this.augmentation instanceof HashMap)) {
            this.augmentation = new HashMap<>();
        }
    
        this.augmentation.put(augmentationType, augmentationValue);
        return this;
    }
    
    public AmfIdBuilder removeAugmentation(Class<? extends Augmentation<AmfId>> augmentationType) {
        if (this.augmentation instanceof HashMap) {
            this.augmentation.remove(augmentationType);
        }
        return this;
    }

    @Override
    public AmfId build() {
        return new AmfIdImpl(this);
    }

    private static final class AmfIdImpl implements AmfId {
    
        private final TAMFPointer _aMFPointer;
        private final TAMFRegionId _aMFRegionId;
        private final TAMFSetId _aMFSetId;
    
        private Map<Class<? extends Augmentation<AmfId>>, Augmentation<AmfId>> augmentation = Collections.emptyMap();
    
        AmfIdImpl(AmfIdBuilder base) {
            this._aMFPointer = base.getAMFPointer();
            this._aMFRegionId = base.getAMFRegionId();
            this._aMFSetId = base.getAMFSetId();
            this.augmentation = ImmutableMap.copyOf(base.augmentation);
        }
    
        @Override
        public Class<AmfId> getImplementedInterface() {
            return AmfId.class;
        }
    
        @Override
        public TAMFPointer getAMFPointer() {
            return _aMFPointer;
        }
        
        @Override
        public TAMFRegionId getAMFRegionId() {
            return _aMFRegionId;
        }
        
        @Override
        public TAMFSetId getAMFSetId() {
            return _aMFSetId;
        }
        
        @SuppressWarnings({ "unchecked", "checkstyle:methodTypeParameterName"})
        @Override
        public <E$$ extends Augmentation<AmfId>> E$$ augmentation(Class<E$$> augmentationType) {
            return (E$$) augmentation.get(CodeHelpers.nonNullValue(augmentationType, "augmentationType"));
        }
    
        private int hash = 0;
        private volatile boolean hashValid = false;
        
        @Override
        public int hashCode() {
            if (hashValid) {
                return hash;
            }
        
            final int prime = 31;
            int result = 1;
            result = prime * result + Objects.hashCode(_aMFPointer);
            result = prime * result + Objects.hashCode(_aMFRegionId);
            result = prime * result + Objects.hashCode(_aMFSetId);
            result = prime * result + Objects.hashCode(augmentation);
        
            hash = result;
            hashValid = true;
            return result;
        }
    
        @Override
        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (!(obj instanceof DataObject)) {
                return false;
            }
            if (!AmfId.class.equals(((DataObject)obj).getImplementedInterface())) {
                return false;
            }
            AmfId other = (AmfId)obj;
            if (!Objects.equals(_aMFPointer, other.getAMFPointer())) {
                return false;
            }
            if (!Objects.equals(_aMFRegionId, other.getAMFRegionId())) {
                return false;
            }
            if (!Objects.equals(_aMFSetId, other.getAMFSetId())) {
                return false;
            }
            if (getClass() == obj.getClass()) {
                // Simple case: we are comparing against self
                AmfIdImpl otherImpl = (AmfIdImpl) obj;
                if (!Objects.equals(augmentation, otherImpl.augmentation)) {
                    return false;
                }
            } else {
                // Hard case: compare our augments with presence there...
                for (Map.Entry<Class<? extends Augmentation<AmfId>>, Augmentation<AmfId>> e : augmentation.entrySet()) {
                    if (!e.getValue().equals(other.augmentation(e.getKey()))) {
                        return false;
                    }
                }
                // .. and give the other one the chance to do the same
                if (!obj.equals(this)) {
                    return false;
                }
            }
            return true;
        }
    
        @Override
        public String toString() {
            final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper("AmfId");
            CodeHelpers.appendValue(helper, "_aMFPointer", _aMFPointer);
            CodeHelpers.appendValue(helper, "_aMFRegionId", _aMFRegionId);
            CodeHelpers.appendValue(helper, "_aMFSetId", _aMFSetId);
            CodeHelpers.appendValue(helper, "augmentation", augmentation.values());
            return helper.toString();
        }
    }
}