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 public class TRowMutations implements org.apache.thrift.TBase<TRowMutations, TRowMutations._Fields>, java.io.Serializable, Cloneable {
34 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRowMutations");
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 MUTATIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("mutations", org.apache.thrift.protocol.TType.LIST, (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 TRowMutationsStandardSchemeFactory());
42 schemes.put(TupleScheme.class, new TRowMutationsTupleSchemeFactory());
43 }
44
45 public ByteBuffer row;
46 public List<TMutation> mutations;
47
48
49 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
50 ROW((short)1, "row"),
51 MUTATIONS((short)2, "mutations");
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 MUTATIONS;
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.REQUIRED,
114 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
115 tmpMap.put(_Fields.MUTATIONS, new org.apache.thrift.meta_data.FieldMetaData("mutations", org.apache.thrift.TFieldRequirementType.REQUIRED,
116 new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
117 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TMutation.class))));
118 metaDataMap = Collections.unmodifiableMap(tmpMap);
119 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TRowMutations.class, metaDataMap);
120 }
121
122 public TRowMutations() {
123 }
124
125 public TRowMutations(
126 ByteBuffer row,
127 List<TMutation> mutations)
128 {
129 this();
130 this.row = row;
131 this.mutations = mutations;
132 }
133
134
135
136
137 public TRowMutations(TRowMutations other) {
138 if (other.isSetRow()) {
139 this.row = org.apache.thrift.TBaseHelper.copyBinary(other.row);
140 ;
141 }
142 if (other.isSetMutations()) {
143 List<TMutation> __this__mutations = new ArrayList<TMutation>();
144 for (TMutation other_element : other.mutations) {
145 __this__mutations.add(new TMutation(other_element));
146 }
147 this.mutations = __this__mutations;
148 }
149 }
150
151 public TRowMutations deepCopy() {
152 return new TRowMutations(this);
153 }
154
155 @Override
156 public void clear() {
157 this.row = null;
158 this.mutations = null;
159 }
160
161 public byte[] getRow() {
162 setRow(org.apache.thrift.TBaseHelper.rightSize(row));
163 return row == null ? null : row.array();
164 }
165
166 public ByteBuffer bufferForRow() {
167 return row;
168 }
169
170 public TRowMutations setRow(byte[] row) {
171 setRow(row == null ? (ByteBuffer)null : ByteBuffer.wrap(row));
172 return this;
173 }
174
175 public TRowMutations setRow(ByteBuffer row) {
176 this.row = row;
177 return this;
178 }
179
180 public void unsetRow() {
181 this.row = null;
182 }
183
184
185 public boolean isSetRow() {
186 return this.row != null;
187 }
188
189 public void setRowIsSet(boolean value) {
190 if (!value) {
191 this.row = null;
192 }
193 }
194
195 public int getMutationsSize() {
196 return (this.mutations == null) ? 0 : this.mutations.size();
197 }
198
199 public java.util.Iterator<TMutation> getMutationsIterator() {
200 return (this.mutations == null) ? null : this.mutations.iterator();
201 }
202
203 public void addToMutations(TMutation elem) {
204 if (this.mutations == null) {
205 this.mutations = new ArrayList<TMutation>();
206 }
207 this.mutations.add(elem);
208 }
209
210 public List<TMutation> getMutations() {
211 return this.mutations;
212 }
213
214 public TRowMutations setMutations(List<TMutation> mutations) {
215 this.mutations = mutations;
216 return this;
217 }
218
219 public void unsetMutations() {
220 this.mutations = null;
221 }
222
223
224 public boolean isSetMutations() {
225 return this.mutations != null;
226 }
227
228 public void setMutationsIsSet(boolean value) {
229 if (!value) {
230 this.mutations = null;
231 }
232 }
233
234 public void setFieldValue(_Fields field, Object value) {
235 switch (field) {
236 case ROW:
237 if (value == null) {
238 unsetRow();
239 } else {
240 setRow((ByteBuffer)value);
241 }
242 break;
243
244 case MUTATIONS:
245 if (value == null) {
246 unsetMutations();
247 } else {
248 setMutations((List<TMutation>)value);
249 }
250 break;
251
252 }
253 }
254
255 public Object getFieldValue(_Fields field) {
256 switch (field) {
257 case ROW:
258 return getRow();
259
260 case MUTATIONS:
261 return getMutations();
262
263 }
264 throw new IllegalStateException();
265 }
266
267
268 public boolean isSet(_Fields field) {
269 if (field == null) {
270 throw new IllegalArgumentException();
271 }
272
273 switch (field) {
274 case ROW:
275 return isSetRow();
276 case MUTATIONS:
277 return isSetMutations();
278 }
279 throw new IllegalStateException();
280 }
281
282 @Override
283 public boolean equals(Object that) {
284 if (that == null)
285 return false;
286 if (that instanceof TRowMutations)
287 return this.equals((TRowMutations)that);
288 return false;
289 }
290
291 public boolean equals(TRowMutations 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 (!this.row.equals(that.row))
301 return false;
302 }
303
304 boolean this_present_mutations = true && this.isSetMutations();
305 boolean that_present_mutations = true && that.isSetMutations();
306 if (this_present_mutations || that_present_mutations) {
307 if (!(this_present_mutations && that_present_mutations))
308 return false;
309 if (!this.mutations.equals(that.mutations))
310 return false;
311 }
312
313 return true;
314 }
315
316 @Override
317 public int hashCode() {
318 return 0;
319 }
320
321 public int compareTo(TRowMutations other) {
322 if (!getClass().equals(other.getClass())) {
323 return getClass().getName().compareTo(other.getClass().getName());
324 }
325
326 int lastComparison = 0;
327 TRowMutations typedOther = (TRowMutations)other;
328
329 lastComparison = Boolean.valueOf(isSetRow()).compareTo(typedOther.isSetRow());
330 if (lastComparison != 0) {
331 return lastComparison;
332 }
333 if (isSetRow()) {
334 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.row, typedOther.row);
335 if (lastComparison != 0) {
336 return lastComparison;
337 }
338 }
339 lastComparison = Boolean.valueOf(isSetMutations()).compareTo(typedOther.isSetMutations());
340 if (lastComparison != 0) {
341 return lastComparison;
342 }
343 if (isSetMutations()) {
344 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mutations, typedOther.mutations);
345 if (lastComparison != 0) {
346 return lastComparison;
347 }
348 }
349 return 0;
350 }
351
352 public _Fields fieldForId(int fieldId) {
353 return _Fields.findByThriftId(fieldId);
354 }
355
356 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
357 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
358 }
359
360 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
361 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
362 }
363
364 @Override
365 public String toString() {
366 StringBuilder sb = new StringBuilder("TRowMutations(");
367 boolean first = true;
368
369 sb.append("row:");
370 if (this.row == null) {
371 sb.append("null");
372 } else {
373 org.apache.thrift.TBaseHelper.toString(this.row, sb);
374 }
375 first = false;
376 if (!first) sb.append(", ");
377 sb.append("mutations:");
378 if (this.mutations == null) {
379 sb.append("null");
380 } else {
381 sb.append(this.mutations);
382 }
383 first = false;
384 sb.append(")");
385 return sb.toString();
386 }
387
388 public void validate() throws org.apache.thrift.TException {
389
390 if (row == null) {
391 throw new org.apache.thrift.protocol.TProtocolException("Required field 'row' was not present! Struct: " + toString());
392 }
393 if (mutations == null) {
394 throw new org.apache.thrift.protocol.TProtocolException("Required field 'mutations' was not present! Struct: " + toString());
395 }
396 }
397
398 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
399 try {
400 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
401 } catch (org.apache.thrift.TException te) {
402 throw new java.io.IOException(te);
403 }
404 }
405
406 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
407 try {
408 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
409 } catch (org.apache.thrift.TException te) {
410 throw new java.io.IOException(te);
411 }
412 }
413
414 private static class TRowMutationsStandardSchemeFactory implements SchemeFactory {
415 public TRowMutationsStandardScheme getScheme() {
416 return new TRowMutationsStandardScheme();
417 }
418 }
419
420 private static class TRowMutationsStandardScheme extends StandardScheme<TRowMutations> {
421
422 public void read(org.apache.thrift.protocol.TProtocol iprot, TRowMutations struct) throws org.apache.thrift.TException {
423 org.apache.thrift.protocol.TField schemeField;
424 iprot.readStructBegin();
425 while (true)
426 {
427 schemeField = iprot.readFieldBegin();
428 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
429 break;
430 }
431 switch (schemeField.id) {
432 case 1:
433 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
434 struct.row = iprot.readBinary();
435 struct.setRowIsSet(true);
436 } else {
437 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
438 }
439 break;
440 case 2:
441 if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
442 {
443 org.apache.thrift.protocol.TList _list98 = iprot.readListBegin();
444 struct.mutations = new ArrayList<TMutation>(_list98.size);
445 for (int _i99 = 0; _i99 < _list98.size; ++_i99)
446 {
447 TMutation _elem100;
448 _elem100 = new TMutation();
449 _elem100.read(iprot);
450 struct.mutations.add(_elem100);
451 }
452 iprot.readListEnd();
453 }
454 struct.setMutationsIsSet(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, TRowMutations 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.mutations != null) {
480 oprot.writeFieldBegin(MUTATIONS_FIELD_DESC);
481 {
482 oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.mutations.size()));
483 for (TMutation _iter101 : struct.mutations)
484 {
485 _iter101.write(oprot);
486 }
487 oprot.writeListEnd();
488 }
489 oprot.writeFieldEnd();
490 }
491 oprot.writeFieldStop();
492 oprot.writeStructEnd();
493 }
494
495 }
496
497 private static class TRowMutationsTupleSchemeFactory implements SchemeFactory {
498 public TRowMutationsTupleScheme getScheme() {
499 return new TRowMutationsTupleScheme();
500 }
501 }
502
503 private static class TRowMutationsTupleScheme extends TupleScheme<TRowMutations> {
504
505 @Override
506 public void write(org.apache.thrift.protocol.TProtocol prot, TRowMutations struct) throws org.apache.thrift.TException {
507 TTupleProtocol oprot = (TTupleProtocol) prot;
508 oprot.writeBinary(struct.row);
509 {
510 oprot.writeI32(struct.mutations.size());
511 for (TMutation _iter102 : struct.mutations)
512 {
513 _iter102.write(oprot);
514 }
515 }
516 }
517
518 @Override
519 public void read(org.apache.thrift.protocol.TProtocol prot, TRowMutations struct) throws org.apache.thrift.TException {
520 TTupleProtocol iprot = (TTupleProtocol) prot;
521 struct.row = iprot.readBinary();
522 struct.setRowIsSet(true);
523 {
524 org.apache.thrift.protocol.TList _list103 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
525 struct.mutations = new ArrayList<TMutation>(_list103.size);
526 for (int _i104 = 0; _i104 < _list103.size; ++_i104)
527 {
528 TMutation _elem105;
529 _elem105 = new TMutation();
530 _elem105.read(iprot);
531 struct.mutations.add(_elem105);
532 }
533 }
534 struct.setMutationsIsSet(true);
535 }
536 }
537
538 }
539