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