1
2
3
4
5
6 package org.apache.hadoop.hbase.thrift.generated;
7
8 import java.util.List;
9 import java.util.ArrayList;
10 import java.util.Map;
11 import java.util.HashMap;
12 import java.util.EnumMap;
13 import java.util.Set;
14 import java.util.HashSet;
15 import java.util.EnumSet;
16 import java.util.Collections;
17 import java.util.BitSet;
18 import java.nio.ByteBuffer;
19 import java.util.Arrays;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
22
23
24
25
26 public class TRowResult implements org.apache.thrift.TBase<TRowResult, TRowResult._Fields>, java.io.Serializable, Cloneable {
27 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRowResult");
28
29 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);
30 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);
31
32 public ByteBuffer row;
33 public Map<ByteBuffer,TCell> columns;
34
35
36 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
37 ROW((short)1, "row"),
38 COLUMNS((short)2, "columns");
39
40 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
41
42 static {
43 for (_Fields field : EnumSet.allOf(_Fields.class)) {
44 byName.put(field.getFieldName(), field);
45 }
46 }
47
48
49
50
51 public static _Fields findByThriftId(int fieldId) {
52 switch(fieldId) {
53 case 1:
54 return ROW;
55 case 2:
56 return COLUMNS;
57 default:
58 return null;
59 }
60 }
61
62
63
64
65
66 public static _Fields findByThriftIdOrThrow(int fieldId) {
67 _Fields fields = findByThriftId(fieldId);
68 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
69 return fields;
70 }
71
72
73
74
75 public static _Fields findByName(String name) {
76 return byName.get(name);
77 }
78
79 private final short _thriftId;
80 private final String _fieldName;
81
82 _Fields(short thriftId, String fieldName) {
83 _thriftId = thriftId;
84 _fieldName = fieldName;
85 }
86
87 public short getThriftFieldId() {
88 return _thriftId;
89 }
90
91 public String getFieldName() {
92 return _fieldName;
93 }
94 }
95
96
97
98 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
99 static {
100 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
101 tmpMap.put(_Fields.ROW, new org.apache.thrift.meta_data.FieldMetaData("row", org.apache.thrift.TFieldRequirementType.DEFAULT,
102 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text")));
103 tmpMap.put(_Fields.COLUMNS, new org.apache.thrift.meta_data.FieldMetaData("columns", org.apache.thrift.TFieldRequirementType.DEFAULT,
104 new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
105 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text"),
106 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TCell.class))));
107 metaDataMap = Collections.unmodifiableMap(tmpMap);
108 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TRowResult.class, metaDataMap);
109 }
110
111 public TRowResult() {
112 }
113
114 public TRowResult(
115 ByteBuffer row,
116 Map<ByteBuffer,TCell> columns)
117 {
118 this();
119 this.row = row;
120 this.columns = columns;
121 }
122
123
124
125
126 public TRowResult(TRowResult other) {
127 if (other.isSetRow()) {
128 this.row = other.row;
129 }
130 if (other.isSetColumns()) {
131 Map<ByteBuffer,TCell> __this__columns = new HashMap<ByteBuffer,TCell>();
132 for (Map.Entry<ByteBuffer, TCell> other_element : other.columns.entrySet()) {
133
134 ByteBuffer other_element_key = other_element.getKey();
135 TCell other_element_value = other_element.getValue();
136
137 ByteBuffer __this__columns_copy_key = other_element_key;
138
139 TCell __this__columns_copy_value = new TCell(other_element_value);
140
141 __this__columns.put(__this__columns_copy_key, __this__columns_copy_value);
142 }
143 this.columns = __this__columns;
144 }
145 }
146
147 public TRowResult deepCopy() {
148 return new TRowResult(this);
149 }
150
151 @Override
152 public void clear() {
153 this.row = null;
154 this.columns = null;
155 }
156
157 public byte[] getRow() {
158 setRow(org.apache.thrift.TBaseHelper.rightSize(row));
159 return row == null ? null : row.array();
160 }
161
162 public ByteBuffer bufferForRow() {
163 return row;
164 }
165
166 public TRowResult setRow(byte[] row) {
167 setRow(row == null ? (ByteBuffer)null : ByteBuffer.wrap(row));
168 return this;
169 }
170
171 public TRowResult setRow(ByteBuffer row) {
172 this.row = row;
173 return this;
174 }
175
176 public void unsetRow() {
177 this.row = null;
178 }
179
180
181 public boolean isSetRow() {
182 return this.row != null;
183 }
184
185 public void setRowIsSet(boolean value) {
186 if (!value) {
187 this.row = null;
188 }
189 }
190
191 public int getColumnsSize() {
192 return (this.columns == null) ? 0 : this.columns.size();
193 }
194
195 public void putToColumns(ByteBuffer key, TCell val) {
196 if (this.columns == null) {
197 this.columns = new HashMap<ByteBuffer,TCell>();
198 }
199 this.columns.put(key, val);
200 }
201
202 public Map<ByteBuffer,TCell> getColumns() {
203 return this.columns;
204 }
205
206 public TRowResult setColumns(Map<ByteBuffer,TCell> columns) {
207 this.columns = columns;
208 return this;
209 }
210
211 public void unsetColumns() {
212 this.columns = null;
213 }
214
215
216 public boolean isSetColumns() {
217 return this.columns != null;
218 }
219
220 public void setColumnsIsSet(boolean value) {
221 if (!value) {
222 this.columns = null;
223 }
224 }
225
226 public void setFieldValue(_Fields field, Object value) {
227 switch (field) {
228 case ROW:
229 if (value == null) {
230 unsetRow();
231 } else {
232 setRow((ByteBuffer)value);
233 }
234 break;
235
236 case COLUMNS:
237 if (value == null) {
238 unsetColumns();
239 } else {
240 setColumns((Map<ByteBuffer,TCell>)value);
241 }
242 break;
243
244 }
245 }
246
247 public Object getFieldValue(_Fields field) {
248 switch (field) {
249 case ROW:
250 return getRow();
251
252 case COLUMNS:
253 return getColumns();
254
255 }
256 throw new IllegalStateException();
257 }
258
259
260 public boolean isSet(_Fields field) {
261 if (field == null) {
262 throw new IllegalArgumentException();
263 }
264
265 switch (field) {
266 case ROW:
267 return isSetRow();
268 case COLUMNS:
269 return isSetColumns();
270 }
271 throw new IllegalStateException();
272 }
273
274 @Override
275 public boolean equals(Object that) {
276 if (that == null)
277 return false;
278 if (that instanceof TRowResult)
279 return this.equals((TRowResult)that);
280 return false;
281 }
282
283 public boolean equals(TRowResult that) {
284 if (that == null)
285 return false;
286
287 boolean this_present_row = true && this.isSetRow();
288 boolean that_present_row = true && that.isSetRow();
289 if (this_present_row || that_present_row) {
290 if (!(this_present_row && that_present_row))
291 return false;
292 if (!this.row.equals(that.row))
293 return false;
294 }
295
296 boolean this_present_columns = true && this.isSetColumns();
297 boolean that_present_columns = true && that.isSetColumns();
298 if (this_present_columns || that_present_columns) {
299 if (!(this_present_columns && that_present_columns))
300 return false;
301 if (!this.columns.equals(that.columns))
302 return false;
303 }
304
305 return true;
306 }
307
308 @Override
309 public int hashCode() {
310 return 0;
311 }
312
313 public int compareTo(TRowResult other) {
314 if (!getClass().equals(other.getClass())) {
315 return getClass().getName().compareTo(other.getClass().getName());
316 }
317
318 int lastComparison = 0;
319 TRowResult typedOther = (TRowResult)other;
320
321 lastComparison = Boolean.valueOf(isSetRow()).compareTo(typedOther.isSetRow());
322 if (lastComparison != 0) {
323 return lastComparison;
324 }
325 if (isSetRow()) {
326 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.row, typedOther.row);
327 if (lastComparison != 0) {
328 return lastComparison;
329 }
330 }
331 lastComparison = Boolean.valueOf(isSetColumns()).compareTo(typedOther.isSetColumns());
332 if (lastComparison != 0) {
333 return lastComparison;
334 }
335 if (isSetColumns()) {
336 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columns, typedOther.columns);
337 if (lastComparison != 0) {
338 return lastComparison;
339 }
340 }
341 return 0;
342 }
343
344 public _Fields fieldForId(int fieldId) {
345 return _Fields.findByThriftId(fieldId);
346 }
347
348 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
349 org.apache.thrift.protocol.TField field;
350 iprot.readStructBegin();
351 while (true)
352 {
353 field = iprot.readFieldBegin();
354 if (field.type == org.apache.thrift.protocol.TType.STOP) {
355 break;
356 }
357 switch (field.id) {
358 case 1:
359 if (field.type == org.apache.thrift.protocol.TType.STRING) {
360 this.row = iprot.readBinary();
361 } else {
362 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
363 }
364 break;
365 case 2:
366 if (field.type == org.apache.thrift.protocol.TType.MAP) {
367 {
368 org.apache.thrift.protocol.TMap _map4 = iprot.readMapBegin();
369 this.columns = new HashMap<ByteBuffer,TCell>(2*_map4.size);
370 for (int _i5 = 0; _i5 < _map4.size; ++_i5)
371 {
372 ByteBuffer _key6;
373 TCell _val7;
374 _key6 = iprot.readBinary();
375 _val7 = new TCell();
376 _val7.read(iprot);
377 this.columns.put(_key6, _val7);
378 }
379 iprot.readMapEnd();
380 }
381 } else {
382 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
383 }
384 break;
385 default:
386 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
387 }
388 iprot.readFieldEnd();
389 }
390 iprot.readStructEnd();
391
392
393 validate();
394 }
395
396 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
397 validate();
398
399 oprot.writeStructBegin(STRUCT_DESC);
400 if (this.row != null) {
401 oprot.writeFieldBegin(ROW_FIELD_DESC);
402 oprot.writeBinary(this.row);
403 oprot.writeFieldEnd();
404 }
405 if (this.columns != null) {
406 oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
407 {
408 oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, this.columns.size()));
409 for (Map.Entry<ByteBuffer, TCell> _iter8 : this.columns.entrySet())
410 {
411 oprot.writeBinary(_iter8.getKey());
412 _iter8.getValue().write(oprot);
413 }
414 oprot.writeMapEnd();
415 }
416 oprot.writeFieldEnd();
417 }
418 oprot.writeFieldStop();
419 oprot.writeStructEnd();
420 }
421
422 @Override
423 public String toString() {
424 StringBuilder sb = new StringBuilder("TRowResult(");
425 boolean first = true;
426
427 sb.append("row:");
428 if (this.row == null) {
429 sb.append("null");
430 } else {
431 sb.append(this.row);
432 }
433 first = false;
434 if (!first) sb.append(", ");
435 sb.append("columns:");
436 if (this.columns == null) {
437 sb.append("null");
438 } else {
439 sb.append(this.columns);
440 }
441 first = false;
442 sb.append(")");
443 return sb.toString();
444 }
445
446 public void validate() throws org.apache.thrift.TException {
447
448 }
449
450 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
451 try {
452 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
453 } catch (org.apache.thrift.TException te) {
454 throw new java.io.IOException(te);
455 }
456 }
457
458 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
459 try {
460 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
461 } catch (org.apache.thrift.TException te) {
462 throw new java.io.IOException(te);
463 }
464 }
465
466 }
467