1
2
3
4
5
6
7 package org.apache.hadoop.hbase.thrift.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 public class TRowResult implements org.apache.thrift.TBase<TRowResult, TRowResult._Fields>, java.io.Serializable, Cloneable {
34 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRowResult");
35
36 private static final org.apache.thrift.protocol.TField ROW_FIELD_DESC = new org.apache.thrift.protocol.TField("row", org.apache.thrift.protocol.TType.STRING, (short)1);
37 private static final org.apache.thrift.protocol.TField COLUMNS_FIELD_DESC = new org.apache.thrift.protocol.TField("columns", org.apache.thrift.protocol.TType.MAP, (short)2);
38
39 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
40 static {
41 schemes.put(StandardScheme.class, new TRowResultStandardSchemeFactory());
42 schemes.put(TupleScheme.class, new TRowResultTupleSchemeFactory());
43 }
44
45 public ByteBuffer row;
46 public Map<ByteBuffer,TCell> columns;
47
48
49 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
50 ROW((short)1, "row"),
51 COLUMNS((short)2, "columns");
52
53 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
54
55 static {
56 for (_Fields field : EnumSet.allOf(_Fields.class)) {
57 byName.put(field.getFieldName(), field);
58 }
59 }
60
61
62
63
64 public static _Fields findByThriftId(int fieldId) {
65 switch(fieldId) {
66 case 1:
67 return ROW;
68 case 2:
69 return COLUMNS;
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 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
111 static {
112 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
113 tmpMap.put(_Fields.ROW, new org.apache.thrift.meta_data.FieldMetaData("row", org.apache.thrift.TFieldRequirementType.DEFAULT,
114 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text")));
115 tmpMap.put(_Fields.COLUMNS, new org.apache.thrift.meta_data.FieldMetaData("columns", org.apache.thrift.TFieldRequirementType.DEFAULT,
116 new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
117 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text"),
118 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TCell.class))));
119 metaDataMap = Collections.unmodifiableMap(tmpMap);
120 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TRowResult.class, metaDataMap);
121 }
122
123 public TRowResult() {
124 }
125
126 public TRowResult(
127 ByteBuffer row,
128 Map<ByteBuffer,TCell> columns)
129 {
130 this();
131 this.row = row;
132 this.columns = columns;
133 }
134
135
136
137
138 public TRowResult(TRowResult other) {
139 if (other.isSetRow()) {
140 this.row = other.row;
141 }
142 if (other.isSetColumns()) {
143 Map<ByteBuffer,TCell> __this__columns = new HashMap<ByteBuffer,TCell>();
144 for (Map.Entry<ByteBuffer, TCell> other_element : other.columns.entrySet()) {
145
146 ByteBuffer other_element_key = other_element.getKey();
147 TCell other_element_value = other_element.getValue();
148
149 ByteBuffer __this__columns_copy_key = other_element_key;
150
151 TCell __this__columns_copy_value = new TCell(other_element_value);
152
153 __this__columns.put(__this__columns_copy_key, __this__columns_copy_value);
154 }
155 this.columns = __this__columns;
156 }
157 }
158
159 public TRowResult deepCopy() {
160 return new TRowResult(this);
161 }
162
163 @Override
164 public void clear() {
165 this.row = null;
166 this.columns = null;
167 }
168
169 public byte[] getRow() {
170 setRow(org.apache.thrift.TBaseHelper.rightSize(row));
171 return row == null ? null : row.array();
172 }
173
174 public ByteBuffer bufferForRow() {
175 return row;
176 }
177
178 public TRowResult setRow(byte[] row) {
179 setRow(row == null ? (ByteBuffer)null : ByteBuffer.wrap(row));
180 return this;
181 }
182
183 public TRowResult setRow(ByteBuffer row) {
184 this.row = row;
185 return this;
186 }
187
188 public void unsetRow() {
189 this.row = null;
190 }
191
192
193 public boolean isSetRow() {
194 return this.row != null;
195 }
196
197 public void setRowIsSet(boolean value) {
198 if (!value) {
199 this.row = null;
200 }
201 }
202
203 public int getColumnsSize() {
204 return (this.columns == null) ? 0 : this.columns.size();
205 }
206
207 public void putToColumns(ByteBuffer key, TCell val) {
208 if (this.columns == null) {
209 this.columns = new HashMap<ByteBuffer,TCell>();
210 }
211 this.columns.put(key, val);
212 }
213
214 public Map<ByteBuffer,TCell> getColumns() {
215 return this.columns;
216 }
217
218 public TRowResult setColumns(Map<ByteBuffer,TCell> columns) {
219 this.columns = columns;
220 return this;
221 }
222
223 public void unsetColumns() {
224 this.columns = null;
225 }
226
227
228 public boolean isSetColumns() {
229 return this.columns != null;
230 }
231
232 public void setColumnsIsSet(boolean value) {
233 if (!value) {
234 this.columns = null;
235 }
236 }
237
238 public void setFieldValue(_Fields field, Object value) {
239 switch (field) {
240 case ROW:
241 if (value == null) {
242 unsetRow();
243 } else {
244 setRow((ByteBuffer)value);
245 }
246 break;
247
248 case COLUMNS:
249 if (value == null) {
250 unsetColumns();
251 } else {
252 setColumns((Map<ByteBuffer,TCell>)value);
253 }
254 break;
255
256 }
257 }
258
259 public Object getFieldValue(_Fields field) {
260 switch (field) {
261 case ROW:
262 return getRow();
263
264 case COLUMNS:
265 return getColumns();
266
267 }
268 throw new IllegalStateException();
269 }
270
271
272 public boolean isSet(_Fields field) {
273 if (field == null) {
274 throw new IllegalArgumentException();
275 }
276
277 switch (field) {
278 case ROW:
279 return isSetRow();
280 case COLUMNS:
281 return isSetColumns();
282 }
283 throw new IllegalStateException();
284 }
285
286 @Override
287 public boolean equals(Object that) {
288 if (that == null)
289 return false;
290 if (that instanceof TRowResult)
291 return this.equals((TRowResult)that);
292 return false;
293 }
294
295 public boolean equals(TRowResult that) {
296 if (that == null)
297 return false;
298
299 boolean this_present_row = true && this.isSetRow();
300 boolean that_present_row = true && that.isSetRow();
301 if (this_present_row || that_present_row) {
302 if (!(this_present_row && that_present_row))
303 return false;
304 if (!this.row.equals(that.row))
305 return false;
306 }
307
308 boolean this_present_columns = true && this.isSetColumns();
309 boolean that_present_columns = true && that.isSetColumns();
310 if (this_present_columns || that_present_columns) {
311 if (!(this_present_columns && that_present_columns))
312 return false;
313 if (!this.columns.equals(that.columns))
314 return false;
315 }
316
317 return true;
318 }
319
320 @Override
321 public int hashCode() {
322 return 0;
323 }
324
325 public int compareTo(TRowResult other) {
326 if (!getClass().equals(other.getClass())) {
327 return getClass().getName().compareTo(other.getClass().getName());
328 }
329
330 int lastComparison = 0;
331 TRowResult typedOther = (TRowResult)other;
332
333 lastComparison = Boolean.valueOf(isSetRow()).compareTo(typedOther.isSetRow());
334 if (lastComparison != 0) {
335 return lastComparison;
336 }
337 if (isSetRow()) {
338 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.row, typedOther.row);
339 if (lastComparison != 0) {
340 return lastComparison;
341 }
342 }
343 lastComparison = Boolean.valueOf(isSetColumns()).compareTo(typedOther.isSetColumns());
344 if (lastComparison != 0) {
345 return lastComparison;
346 }
347 if (isSetColumns()) {
348 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columns, typedOther.columns);
349 if (lastComparison != 0) {
350 return lastComparison;
351 }
352 }
353 return 0;
354 }
355
356 public _Fields fieldForId(int fieldId) {
357 return _Fields.findByThriftId(fieldId);
358 }
359
360 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
361 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
362 }
363
364 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
365 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
366 }
367
368 @Override
369 public String toString() {
370 StringBuilder sb = new StringBuilder("TRowResult(");
371 boolean first = true;
372
373 sb.append("row:");
374 if (this.row == null) {
375 sb.append("null");
376 } else {
377 sb.append(this.row);
378 }
379 first = false;
380 if (!first) sb.append(", ");
381 sb.append("columns:");
382 if (this.columns == null) {
383 sb.append("null");
384 } else {
385 sb.append(this.columns);
386 }
387 first = false;
388 sb.append(")");
389 return sb.toString();
390 }
391
392 public void validate() throws org.apache.thrift.TException {
393
394 }
395
396 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
397 try {
398 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
399 } catch (org.apache.thrift.TException te) {
400 throw new java.io.IOException(te);
401 }
402 }
403
404 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
405 try {
406 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
407 } catch (org.apache.thrift.TException te) {
408 throw new java.io.IOException(te);
409 }
410 }
411
412 private static class TRowResultStandardSchemeFactory implements SchemeFactory {
413 public TRowResultStandardScheme getScheme() {
414 return new TRowResultStandardScheme();
415 }
416 }
417
418 private static class TRowResultStandardScheme extends StandardScheme<TRowResult> {
419
420 public void read(org.apache.thrift.protocol.TProtocol iprot, TRowResult struct) throws org.apache.thrift.TException {
421 org.apache.thrift.protocol.TField schemeField;
422 iprot.readStructBegin();
423 while (true)
424 {
425 schemeField = iprot.readFieldBegin();
426 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
427 break;
428 }
429 switch (schemeField.id) {
430 case 1:
431 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
432 struct.row = iprot.readBinary();
433 struct.setRowIsSet(true);
434 } else {
435 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
436 }
437 break;
438 case 2:
439 if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
440 {
441 org.apache.thrift.protocol.TMap _map8 = iprot.readMapBegin();
442 struct.columns = new HashMap<ByteBuffer,TCell>(2*_map8.size);
443 for (int _i9 = 0; _i9 < _map8.size; ++_i9)
444 {
445 ByteBuffer _key10;
446 TCell _val11;
447 _key10 = iprot.readBinary();
448 _val11 = new TCell();
449 _val11.read(iprot);
450 struct.columns.put(_key10, _val11);
451 }
452 iprot.readMapEnd();
453 }
454 struct.setColumnsIsSet(true);
455 } else {
456 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
457 }
458 break;
459 default:
460 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
461 }
462 iprot.readFieldEnd();
463 }
464 iprot.readStructEnd();
465
466
467 struct.validate();
468 }
469
470 public void write(org.apache.thrift.protocol.TProtocol oprot, TRowResult struct) throws org.apache.thrift.TException {
471 struct.validate();
472
473 oprot.writeStructBegin(STRUCT_DESC);
474 if (struct.row != null) {
475 oprot.writeFieldBegin(ROW_FIELD_DESC);
476 oprot.writeBinary(struct.row);
477 oprot.writeFieldEnd();
478 }
479 if (struct.columns != null) {
480 oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
481 {
482 oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, struct.columns.size()));
483 for (Map.Entry<ByteBuffer, TCell> _iter12 : struct.columns.entrySet())
484 {
485 oprot.writeBinary(_iter12.getKey());
486 _iter12.getValue().write(oprot);
487 }
488 oprot.writeMapEnd();
489 }
490 oprot.writeFieldEnd();
491 }
492 oprot.writeFieldStop();
493 oprot.writeStructEnd();
494 }
495
496 }
497
498 private static class TRowResultTupleSchemeFactory implements SchemeFactory {
499 public TRowResultTupleScheme getScheme() {
500 return new TRowResultTupleScheme();
501 }
502 }
503
504 private static class TRowResultTupleScheme extends TupleScheme<TRowResult> {
505
506 @Override
507 public void write(org.apache.thrift.protocol.TProtocol prot, TRowResult struct) throws org.apache.thrift.TException {
508 TTupleProtocol oprot = (TTupleProtocol) prot;
509 BitSet optionals = new BitSet();
510 if (struct.isSetRow()) {
511 optionals.set(0);
512 }
513 if (struct.isSetColumns()) {
514 optionals.set(1);
515 }
516 oprot.writeBitSet(optionals, 2);
517 if (struct.isSetRow()) {
518 oprot.writeBinary(struct.row);
519 }
520 if (struct.isSetColumns()) {
521 {
522 oprot.writeI32(struct.columns.size());
523 for (Map.Entry<ByteBuffer, TCell> _iter13 : struct.columns.entrySet())
524 {
525 oprot.writeBinary(_iter13.getKey());
526 _iter13.getValue().write(oprot);
527 }
528 }
529 }
530 }
531
532 @Override
533 public void read(org.apache.thrift.protocol.TProtocol prot, TRowResult struct) throws org.apache.thrift.TException {
534 TTupleProtocol iprot = (TTupleProtocol) prot;
535 BitSet incoming = iprot.readBitSet(2);
536 if (incoming.get(0)) {
537 struct.row = iprot.readBinary();
538 struct.setRowIsSet(true);
539 }
540 if (incoming.get(1)) {
541 {
542 org.apache.thrift.protocol.TMap _map14 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
543 struct.columns = new HashMap<ByteBuffer,TCell>(2*_map14.size);
544 for (int _i15 = 0; _i15 < _map14.size; ++_i15)
545 {
546 ByteBuffer _key16;
547 TCell _val17;
548 _key16 = iprot.readBinary();
549 _val17 = new TCell();
550 _val17.read(iprot);
551 struct.columns.put(_key16, _val17);
552 }
553 }
554 struct.setColumnsIsSet(true);
555 }
556 }
557 }
558
559 }
560