/
FooBarSpecificRecord.java
169 lines (148 loc) · 5.79 KB
/
FooBarSpecificRecord.java
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
/**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package org.apache.avro;
@SuppressWarnings("all")
public class FooBarSpecificRecord extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
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\":\"relatedids\",\"type\":{\"type\":\"array\",\"items\":\"int\"}}]}");
@Deprecated public int id;
@Deprecated public java.util.List<java.lang.Integer> relatedids;
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 relatedids;
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: relatedids = (java.util.List<java.lang.Integer>)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 '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;
}
/** 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.util.List<java.lang.Integer> relatedids;
/** 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);
}
/** 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.relatedids)) {
this.relatedids = data().deepCopy(fields()[1].schema(), other.relatedids);
fieldSetFlags()[1] = 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 '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()[1], value);
this.relatedids = value;
fieldSetFlags()[1] = true;
return this;
}
/** Checks whether the 'relatedids' field has been set */
public boolean hasRelatedids() {
return fieldSetFlags()[1];
}
/** Clears the value of the 'relatedids' field */
public org.apache.avro.FooBarSpecificRecord.Builder clearRelatedids() {
relatedids = null;
fieldSetFlags()[1] = 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.relatedids = fieldSetFlags()[1] ? this.relatedids : (java.util.List<java.lang.Integer>) defaultValue(fields()[1]);
return record;
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
}
}
}
}