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