1
2
3
4
5
6
7 package org.apache.hadoop.hbase.thrift2.generated;
8
9 import org.apache.thrift.scheme.IScheme;
10 import org.apache.thrift.scheme.SchemeFactory;
11 import org.apache.thrift.scheme.StandardScheme;
12
13 import org.apache.thrift.scheme.TupleScheme;
14 import org.apache.thrift.protocol.TTupleProtocol;
15 import org.apache.thrift.protocol.TProtocolException;
16 import org.apache.thrift.EncodingUtils;
17 import org.apache.thrift.TException;
18 import java.util.List;
19 import java.util.ArrayList;
20 import java.util.Map;
21 import java.util.HashMap;
22 import java.util.EnumMap;
23 import java.util.Set;
24 import java.util.HashSet;
25 import java.util.EnumSet;
26 import java.util.Collections;
27 import java.util.BitSet;
28 import java.nio.ByteBuffer;
29 import java.util.Arrays;
30 import org.slf4j.Logger;
31 import org.slf4j.LoggerFactory;
32
33
34
35
36
37
38 public class TIOError extends TException implements org.apache.thrift.TBase<TIOError, TIOError._Fields>, java.io.Serializable, Cloneable {
39 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TIOError");
40
41 private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1);
42
43 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
44 static {
45 schemes.put(StandardScheme.class, new TIOErrorStandardSchemeFactory());
46 schemes.put(TupleScheme.class, new TIOErrorTupleSchemeFactory());
47 }
48
49 public String message;
50
51
52 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
53 MESSAGE((short)1, "message");
54
55 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
56
57 static {
58 for (_Fields field : EnumSet.allOf(_Fields.class)) {
59 byName.put(field.getFieldName(), field);
60 }
61 }
62
63
64
65
66 public static _Fields findByThriftId(int fieldId) {
67 switch(fieldId) {
68 case 1:
69 return MESSAGE;
70 default:
71 return null;
72 }
73 }
74
75
76
77
78
79 public static _Fields findByThriftIdOrThrow(int fieldId) {
80 _Fields fields = findByThriftId(fieldId);
81 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
82 return fields;
83 }
84
85
86
87
88 public static _Fields findByName(String name) {
89 return byName.get(name);
90 }
91
92 private final short _thriftId;
93 private final String _fieldName;
94
95 _Fields(short thriftId, String fieldName) {
96 _thriftId = thriftId;
97 _fieldName = fieldName;
98 }
99
100 public short getThriftFieldId() {
101 return _thriftId;
102 }
103
104 public String getFieldName() {
105 return _fieldName;
106 }
107 }
108
109
110 private _Fields optionals[] = {_Fields.MESSAGE};
111 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
112 static {
113 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
114 tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.OPTIONAL,
115 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
116 metaDataMap = Collections.unmodifiableMap(tmpMap);
117 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TIOError.class, metaDataMap);
118 }
119
120 public TIOError() {
121 }
122
123
124
125
126 public TIOError(TIOError other) {
127 if (other.isSetMessage()) {
128 this.message = other.message;
129 }
130 }
131
132 public TIOError deepCopy() {
133 return new TIOError(this);
134 }
135
136 @Override
137 public void clear() {
138 this.message = null;
139 }
140
141 public String getMessage() {
142 return this.message;
143 }
144
145 public TIOError setMessage(String message) {
146 this.message = message;
147 return this;
148 }
149
150 public void unsetMessage() {
151 this.message = null;
152 }
153
154
155 public boolean isSetMessage() {
156 return this.message != null;
157 }
158
159 public void setMessageIsSet(boolean value) {
160 if (!value) {
161 this.message = null;
162 }
163 }
164
165 public void setFieldValue(_Fields field, Object value) {
166 switch (field) {
167 case MESSAGE:
168 if (value == null) {
169 unsetMessage();
170 } else {
171 setMessage((String)value);
172 }
173 break;
174
175 }
176 }
177
178 public Object getFieldValue(_Fields field) {
179 switch (field) {
180 case MESSAGE:
181 return getMessage();
182
183 }
184 throw new IllegalStateException();
185 }
186
187
188 public boolean isSet(_Fields field) {
189 if (field == null) {
190 throw new IllegalArgumentException();
191 }
192
193 switch (field) {
194 case MESSAGE:
195 return isSetMessage();
196 }
197 throw new IllegalStateException();
198 }
199
200 @Override
201 public boolean equals(Object that) {
202 if (that == null)
203 return false;
204 if (that instanceof TIOError)
205 return this.equals((TIOError)that);
206 return false;
207 }
208
209 public boolean equals(TIOError that) {
210 if (that == null)
211 return false;
212
213 boolean this_present_message = true && this.isSetMessage();
214 boolean that_present_message = true && that.isSetMessage();
215 if (this_present_message || that_present_message) {
216 if (!(this_present_message && that_present_message))
217 return false;
218 if (!this.message.equals(that.message))
219 return false;
220 }
221
222 return true;
223 }
224
225 @Override
226 public int hashCode() {
227 return 0;
228 }
229
230 public int compareTo(TIOError other) {
231 if (!getClass().equals(other.getClass())) {
232 return getClass().getName().compareTo(other.getClass().getName());
233 }
234
235 int lastComparison = 0;
236 TIOError typedOther = (TIOError)other;
237
238 lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
239 if (lastComparison != 0) {
240 return lastComparison;
241 }
242 if (isSetMessage()) {
243 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, typedOther.message);
244 if (lastComparison != 0) {
245 return lastComparison;
246 }
247 }
248 return 0;
249 }
250
251 public _Fields fieldForId(int fieldId) {
252 return _Fields.findByThriftId(fieldId);
253 }
254
255 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
256 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
257 }
258
259 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
260 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
261 }
262
263 @Override
264 public String toString() {
265 StringBuilder sb = new StringBuilder("TIOError(");
266 boolean first = true;
267
268 if (isSetMessage()) {
269 sb.append("message:");
270 if (this.message == null) {
271 sb.append("null");
272 } else {
273 sb.append(this.message);
274 }
275 first = false;
276 }
277 sb.append(")");
278 return sb.toString();
279 }
280
281 public void validate() throws org.apache.thrift.TException {
282
283
284 }
285
286 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
287 try {
288 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
289 } catch (org.apache.thrift.TException te) {
290 throw new java.io.IOException(te);
291 }
292 }
293
294 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
295 try {
296 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
297 } catch (org.apache.thrift.TException te) {
298 throw new java.io.IOException(te);
299 }
300 }
301
302 private static class TIOErrorStandardSchemeFactory implements SchemeFactory {
303 public TIOErrorStandardScheme getScheme() {
304 return new TIOErrorStandardScheme();
305 }
306 }
307
308 private static class TIOErrorStandardScheme extends StandardScheme<TIOError> {
309
310 public void read(org.apache.thrift.protocol.TProtocol iprot, TIOError struct) throws org.apache.thrift.TException {
311 org.apache.thrift.protocol.TField schemeField;
312 iprot.readStructBegin();
313 while (true)
314 {
315 schemeField = iprot.readFieldBegin();
316 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
317 break;
318 }
319 switch (schemeField.id) {
320 case 1:
321 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
322 struct.message = iprot.readString();
323 struct.setMessageIsSet(true);
324 } else {
325 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
326 }
327 break;
328 default:
329 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
330 }
331 iprot.readFieldEnd();
332 }
333 iprot.readStructEnd();
334
335
336 struct.validate();
337 }
338
339 public void write(org.apache.thrift.protocol.TProtocol oprot, TIOError struct) throws org.apache.thrift.TException {
340 struct.validate();
341
342 oprot.writeStructBegin(STRUCT_DESC);
343 if (struct.message != null) {
344 if (struct.isSetMessage()) {
345 oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
346 oprot.writeString(struct.message);
347 oprot.writeFieldEnd();
348 }
349 }
350 oprot.writeFieldStop();
351 oprot.writeStructEnd();
352 }
353
354 }
355
356 private static class TIOErrorTupleSchemeFactory implements SchemeFactory {
357 public TIOErrorTupleScheme getScheme() {
358 return new TIOErrorTupleScheme();
359 }
360 }
361
362 private static class TIOErrorTupleScheme extends TupleScheme<TIOError> {
363
364 @Override
365 public void write(org.apache.thrift.protocol.TProtocol prot, TIOError struct) throws org.apache.thrift.TException {
366 TTupleProtocol oprot = (TTupleProtocol) prot;
367 BitSet optionals = new BitSet();
368 if (struct.isSetMessage()) {
369 optionals.set(0);
370 }
371 oprot.writeBitSet(optionals, 1);
372 if (struct.isSetMessage()) {
373 oprot.writeString(struct.message);
374 }
375 }
376
377 @Override
378 public void read(org.apache.thrift.protocol.TProtocol prot, TIOError struct) throws org.apache.thrift.TException {
379 TTupleProtocol iprot = (TTupleProtocol) prot;
380 BitSet incoming = iprot.readBitSet(1);
381 if (incoming.get(0)) {
382 struct.message = iprot.readString();
383 struct.setMessageIsSet(true);
384 }
385 }
386 }
387
388 }
389