File: FooBarSpecificRecord.java

package info (click to toggle)
avro-java 1.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 12,784 kB
  • sloc: java: 58,236; ansic: 27,618; cpp: 15,332; cs: 12,876; python: 10,443; xml: 6,338; php: 3,836; ruby: 3,158; perl: 1,656; sh: 733; lex: 203; yacc: 140; makefile: 7
file content (391 lines) | stat: -rw-r--r-- 13,950 bytes parent folder | download
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
/**
 * Autogenerated by Avro
 *
 * DO NOT EDIT DIRECTLY
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.avro;
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class FooBarSpecificRecord extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  private static final long serialVersionUID = 1031933828916876443L;
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"FooBarSpecificRecord\",\"namespace\":\"org.apache.avro\",\"fields\":[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"name\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"nicknames\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}},{\"name\":\"relatedids\",\"type\":{\"type\":\"array\",\"items\":\"int\"}},{\"name\":\"typeEnum\",\"type\":[\"null\",{\"type\":\"enum\",\"name\":\"TypeEnum\",\"symbols\":[\"a\",\"b\",\"c\"]}],\"default\":null}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  @Deprecated public int id;
  @Deprecated public java.lang.String name;
  @Deprecated public java.util.List<java.lang.String> nicknames;
  @Deprecated public java.util.List<java.lang.Integer> relatedids;
  @Deprecated public org.apache.avro.TypeEnum typeEnum;

  /**
   * Default constructor.  Note that this does not initialize fields
   * to their default values from the schema.  If that is desired then
   * one should use <code>newBuilder()</code>.
   */
  public FooBarSpecificRecord() {}

  /**
   * All-args constructor.
   */
  public FooBarSpecificRecord(java.lang.Integer id, java.lang.String name, java.util.List<java.lang.String> nicknames, java.util.List<java.lang.Integer> relatedids, org.apache.avro.TypeEnum typeEnum) {
    this.id = id;
    this.name = name;
    this.nicknames = nicknames;
    this.relatedids = relatedids;
    this.typeEnum = typeEnum;
  }

  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
  // Used by DatumWriter.  Applications should not call.
  public java.lang.Object get(int field$) {
    switch (field$) {
    case 0: return id;
    case 1: return name;
    case 2: return nicknames;
    case 3: return relatedids;
    case 4: return typeEnum;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }
  // Used by DatumReader.  Applications should not call.
  @SuppressWarnings(value="unchecked")
  public void put(int field$, java.lang.Object value$) {
    switch (field$) {
    case 0: id = (java.lang.Integer)value$; break;
    case 1: name = (java.lang.String)value$; break;
    case 2: nicknames = (java.util.List<java.lang.String>)value$; break;
    case 3: relatedids = (java.util.List<java.lang.Integer>)value$; break;
    case 4: typeEnum = (org.apache.avro.TypeEnum)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'id' field.
   */
  public java.lang.Integer getId() {
    return id;
  }

  /**
   * Sets the value of the 'id' field.
   * @param value the value to set.
   */
  public void setId(java.lang.Integer value) {
    this.id = value;
  }

  /**
   * Gets the value of the 'name' field.
   */
  public java.lang.String getName() {
    return name;
  }

  /**
   * Sets the value of the 'name' field.
   * @param value the value to set.
   */
  public void setName(java.lang.String value) {
    this.name = value;
  }

  /**
   * Gets the value of the 'nicknames' field.
   */
  public java.util.List<java.lang.String> getNicknames() {
    return nicknames;
  }

  /**
   * Sets the value of the 'nicknames' field.
   * @param value the value to set.
   */
  public void setNicknames(java.util.List<java.lang.String> value) {
    this.nicknames = value;
  }

  /**
   * Gets the value of the 'relatedids' field.
   */
  public java.util.List<java.lang.Integer> getRelatedids() {
    return relatedids;
  }

  /**
   * Sets the value of the 'relatedids' field.
   * @param value the value to set.
   */
  public void setRelatedids(java.util.List<java.lang.Integer> value) {
    this.relatedids = value;
  }

  /**
   * Gets the value of the 'typeEnum' field.
   */
  public org.apache.avro.TypeEnum getTypeEnum() {
    return typeEnum;
  }

  /**
   * Sets the value of the 'typeEnum' field.
   * @param value the value to set.
   */
  public void setTypeEnum(org.apache.avro.TypeEnum value) {
    this.typeEnum = value;
  }

  /** Creates a new FooBarSpecificRecord RecordBuilder */
  public static org.apache.avro.FooBarSpecificRecord.Builder newBuilder() {
    return new org.apache.avro.FooBarSpecificRecord.Builder();
  }

  /** Creates a new FooBarSpecificRecord RecordBuilder by copying an existing Builder */
  public static org.apache.avro.FooBarSpecificRecord.Builder newBuilder(org.apache.avro.FooBarSpecificRecord.Builder other) {
    return new org.apache.avro.FooBarSpecificRecord.Builder(other);
  }

  /** Creates a new FooBarSpecificRecord RecordBuilder by copying an existing FooBarSpecificRecord instance */
  public static org.apache.avro.FooBarSpecificRecord.Builder newBuilder(org.apache.avro.FooBarSpecificRecord other) {
    return new org.apache.avro.FooBarSpecificRecord.Builder(other);
  }

  /**
   * RecordBuilder for FooBarSpecificRecord instances.
   */
  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<FooBarSpecificRecord>
    implements org.apache.avro.data.RecordBuilder<FooBarSpecificRecord> {

    private int id;
    private java.lang.String name;
    private java.util.List<java.lang.String> nicknames;
    private java.util.List<java.lang.Integer> relatedids;
    private org.apache.avro.TypeEnum typeEnum;

    /** Creates a new Builder */
    private Builder() {
      super(org.apache.avro.FooBarSpecificRecord.SCHEMA$);
    }

    /** Creates a Builder by copying an existing Builder */
    private Builder(org.apache.avro.FooBarSpecificRecord.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.id)) {
        this.id = data().deepCopy(fields()[0].schema(), other.id);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.name)) {
        this.name = data().deepCopy(fields()[1].schema(), other.name);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.nicknames)) {
        this.nicknames = data().deepCopy(fields()[2].schema(), other.nicknames);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.relatedids)) {
        this.relatedids = data().deepCopy(fields()[3].schema(), other.relatedids);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.typeEnum)) {
        this.typeEnum = data().deepCopy(fields()[4].schema(), other.typeEnum);
        fieldSetFlags()[4] = true;
      }
    }

    /** Creates a Builder by copying an existing FooBarSpecificRecord instance */
    private Builder(org.apache.avro.FooBarSpecificRecord other) {
            super(org.apache.avro.FooBarSpecificRecord.SCHEMA$);
      if (isValidValue(fields()[0], other.id)) {
        this.id = data().deepCopy(fields()[0].schema(), other.id);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.name)) {
        this.name = data().deepCopy(fields()[1].schema(), other.name);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.nicknames)) {
        this.nicknames = data().deepCopy(fields()[2].schema(), other.nicknames);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.relatedids)) {
        this.relatedids = data().deepCopy(fields()[3].schema(), other.relatedids);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.typeEnum)) {
        this.typeEnum = data().deepCopy(fields()[4].schema(), other.typeEnum);
        fieldSetFlags()[4] = true;
      }
    }

    /** Gets the value of the 'id' field */
    public java.lang.Integer getId() {
      return id;
    }

    /** Sets the value of the 'id' field */
    public org.apache.avro.FooBarSpecificRecord.Builder setId(int value) {
      validate(fields()[0], value);
      this.id = value;
      fieldSetFlags()[0] = true;
      return this;
    }

    /** Checks whether the 'id' field has been set */
    public boolean hasId() {
      return fieldSetFlags()[0];
    }

    /** Clears the value of the 'id' field */
    public org.apache.avro.FooBarSpecificRecord.Builder clearId() {
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'name' field */
    public java.lang.String getName() {
      return name;
    }

    /** Sets the value of the 'name' field */
    public org.apache.avro.FooBarSpecificRecord.Builder setName(java.lang.String value) {
      validate(fields()[1], value);
      this.name = value;
      fieldSetFlags()[1] = true;
      return this;
    }

    /** Checks whether the 'name' field has been set */
    public boolean hasName() {
      return fieldSetFlags()[1];
    }

    /** Clears the value of the 'name' field */
    public org.apache.avro.FooBarSpecificRecord.Builder clearName() {
      name = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /** Gets the value of the 'nicknames' field */
    public java.util.List<java.lang.String> getNicknames() {
      return nicknames;
    }

    /** Sets the value of the 'nicknames' field */
    public org.apache.avro.FooBarSpecificRecord.Builder setNicknames(java.util.List<java.lang.String> value) {
      validate(fields()[2], value);
      this.nicknames = value;
      fieldSetFlags()[2] = true;
      return this;
    }

    /** Checks whether the 'nicknames' field has been set */
    public boolean hasNicknames() {
      return fieldSetFlags()[2];
    }

    /** Clears the value of the 'nicknames' field */
    public org.apache.avro.FooBarSpecificRecord.Builder clearNicknames() {
      nicknames = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    /** Gets the value of the 'relatedids' field */
    public java.util.List<java.lang.Integer> getRelatedids() {
      return relatedids;
    }

    /** Sets the value of the 'relatedids' field */
    public org.apache.avro.FooBarSpecificRecord.Builder setRelatedids(java.util.List<java.lang.Integer> value) {
      validate(fields()[3], value);
      this.relatedids = value;
      fieldSetFlags()[3] = true;
      return this;
    }

    /** Checks whether the 'relatedids' field has been set */
    public boolean hasRelatedids() {
      return fieldSetFlags()[3];
    }

    /** Clears the value of the 'relatedids' field */
    public org.apache.avro.FooBarSpecificRecord.Builder clearRelatedids() {
      relatedids = null;
      fieldSetFlags()[3] = false;
      return this;
    }

    /** Gets the value of the 'typeEnum' field */
    public org.apache.avro.TypeEnum getTypeEnum() {
      return typeEnum;
    }

    /** Sets the value of the 'typeEnum' field */
    public org.apache.avro.FooBarSpecificRecord.Builder setTypeEnum(org.apache.avro.TypeEnum value) {
      validate(fields()[4], value);
      this.typeEnum = value;
      fieldSetFlags()[4] = true;
      return this;
    }

    /** Checks whether the 'typeEnum' field has been set */
    public boolean hasTypeEnum() {
      return fieldSetFlags()[4];
    }

    /** Clears the value of the 'typeEnum' field */
    public org.apache.avro.FooBarSpecificRecord.Builder clearTypeEnum() {
      typeEnum = null;
      fieldSetFlags()[4] = false;
      return this;
    }

    @Override
    public FooBarSpecificRecord build() {
      try {
        FooBarSpecificRecord record = new FooBarSpecificRecord();
        record.id = fieldSetFlags()[0] ? this.id : (java.lang.Integer) defaultValue(fields()[0]);
        record.name = fieldSetFlags()[1] ? this.name : (java.lang.String) defaultValue(fields()[1]);
        record.nicknames = fieldSetFlags()[2] ? this.nicknames : (java.util.List<java.lang.String>) defaultValue(fields()[2]);
        record.relatedids = fieldSetFlags()[3] ? this.relatedids : (java.util.List<java.lang.Integer>) defaultValue(fields()[3]);
        record.typeEnum = fieldSetFlags()[4] ? this.typeEnum : (org.apache.avro.TypeEnum) defaultValue(fields()[4]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }

  private static final org.apache.avro.io.DatumWriter
    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter<FooBarSpecificRecord>(SCHEMA$);

  @Override public void writeExternal(java.io.ObjectOutput out)
    throws java.io.IOException {
    WRITER$.write(this, org.apache.avro.specific.SpecificData.getEncoder(out));
  }

  private static final org.apache.avro.io.DatumReader
    READER$ = new org.apache.avro.specific.SpecificDatumReader<FooBarSpecificRecord>(SCHEMA$);

  @Override public void readExternal(java.io.ObjectInput in)
    throws java.io.IOException {
    READER$.read(this, org.apache.avro.specific.SpecificData.getDecoder(in));
  }

}