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