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
34
35
36 public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncrement._Fields>, java.io.Serializable, Cloneable {
37 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TIncrement");
38
39 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);
40 private static final org.apache.thrift.protocol.TField COLUMNS_FIELD_DESC = new org.apache.thrift.protocol.TField("columns", org.apache.thrift.protocol.TType.LIST, (short)2);
41 private static final org.apache.thrift.protocol.TField WRITE_TO_WAL_FIELD_DESC = new org.apache.thrift.protocol.TField("writeToWal", org.apache.thrift.protocol.TType.BOOL, (short)3);
42
43 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
44 static {
45 schemes.put(StandardScheme.class, new TIncrementStandardSchemeFactory());
46 schemes.put(TupleScheme.class, new TIncrementTupleSchemeFactory());
47 }
48
49 public ByteBuffer row;
50 public List<TColumnIncrement> columns;
51 public boolean writeToWal;
52
53
54 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
55 ROW((short)1, "row"),
56 COLUMNS((short)2, "columns"),
57 WRITE_TO_WAL((short)3, "writeToWal");
58
59 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
60
61 static {
62 for (_Fields field : EnumSet.allOf(_Fields.class)) {
63 byName.put(field.getFieldName(), field);
64 }
65 }
66
67
68
69
70 public static _Fields findByThriftId(int fieldId) {
71 switch(fieldId) {
72 case 1:
73 return ROW;
74 case 2:
75 return COLUMNS;
76 case 3:
77 return WRITE_TO_WAL;
78 default:
79 return null;
80 }
81 }
82
83
84
85
86
87 public static _Fields findByThriftIdOrThrow(int fieldId) {
88 _Fields fields = findByThriftId(fieldId);
89 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
90 return fields;
91 }
92
93
94
95
96 public static _Fields findByName(String name) {
97 return byName.get(name);
98 }
99
100 private final short _thriftId;
101 private final String _fieldName;
102
103 _Fields(short thriftId, String fieldName) {
104 _thriftId = thriftId;
105 _fieldName = fieldName;
106 }
107
108 public short getThriftFieldId() {
109 return _thriftId;
110 }
111
112 public String getFieldName() {
113 return _fieldName;
114 }
115 }
116
117
118 private static final int __WRITETOWAL_ISSET_ID = 0;
119 private BitSet __isset_bit_vector = new BitSet(1);
120 private _Fields optionals[] = {_Fields.WRITE_TO_WAL};
121 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
122 static {
123 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
124 tmpMap.put(_Fields.ROW, new org.apache.thrift.meta_data.FieldMetaData("row", org.apache.thrift.TFieldRequirementType.REQUIRED,
125 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
126 tmpMap.put(_Fields.COLUMNS, new org.apache.thrift.meta_data.FieldMetaData("columns", org.apache.thrift.TFieldRequirementType.REQUIRED,
127 new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
128 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TColumnIncrement.class))));
129 tmpMap.put(_Fields.WRITE_TO_WAL, new org.apache.thrift.meta_data.FieldMetaData("writeToWal", org.apache.thrift.TFieldRequirementType.OPTIONAL,
130 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
131 metaDataMap = Collections.unmodifiableMap(tmpMap);
132 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TIncrement.class, metaDataMap);
133 }
134
135 public TIncrement() {
136 this.writeToWal = true;
137
138 }
139
140 public TIncrement(
141 ByteBuffer row,
142 List<TColumnIncrement> columns)
143 {
144 this();
145 this.row = row;
146 this.columns = columns;
147 }
148
149
150
151
152 public TIncrement(TIncrement other) {
153 __isset_bit_vector.clear();
154 __isset_bit_vector.or(other.__isset_bit_vector);
155 if (other.isSetRow()) {
156 this.row = org.apache.thrift.TBaseHelper.copyBinary(other.row);
157 ;
158 }
159 if (other.isSetColumns()) {
160 List<TColumnIncrement> __this__columns = new ArrayList<TColumnIncrement>();
161 for (TColumnIncrement other_element : other.columns) {
162 __this__columns.add(new TColumnIncrement(other_element));
163 }
164 this.columns = __this__columns;
165 }
166 this.writeToWal = other.writeToWal;
167 }
168
169 public TIncrement deepCopy() {
170 return new TIncrement(this);
171 }
172
173 @Override
174 public void clear() {
175 this.row = null;
176 this.columns = null;
177 this.writeToWal = true;
178
179 }
180
181 public byte[] getRow() {
182 setRow(org.apache.thrift.TBaseHelper.rightSize(row));
183 return row == null ? null : row.array();
184 }
185
186 public ByteBuffer bufferForRow() {
187 return row;
188 }
189
190 public TIncrement setRow(byte[] row) {
191 setRow(row == null ? (ByteBuffer)null : ByteBuffer.wrap(row));
192 return this;
193 }
194
195 public TIncrement setRow(ByteBuffer row) {
196 this.row = row;
197 return this;
198 }
199
200 public void unsetRow() {
201 this.row = null;
202 }
203
204
205 public boolean isSetRow() {
206 return this.row != null;
207 }
208
209 public void setRowIsSet(boolean value) {
210 if (!value) {
211 this.row = null;
212 }
213 }
214
215 public int getColumnsSize() {
216 return (this.columns == null) ? 0 : this.columns.size();
217 }
218
219 public java.util.Iterator<TColumnIncrement> getColumnsIterator() {
220 return (this.columns == null) ? null : this.columns.iterator();
221 }
222
223 public void addToColumns(TColumnIncrement elem) {
224 if (this.columns == null) {
225 this.columns = new ArrayList<TColumnIncrement>();
226 }
227 this.columns.add(elem);
228 }
229
230 public List<TColumnIncrement> getColumns() {
231 return this.columns;
232 }
233
234 public TIncrement setColumns(List<TColumnIncrement> columns) {
235 this.columns = columns;
236 return this;
237 }
238
239 public void unsetColumns() {
240 this.columns = null;
241 }
242
243
244 public boolean isSetColumns() {
245 return this.columns != null;
246 }
247
248 public void setColumnsIsSet(boolean value) {
249 if (!value) {
250 this.columns = null;
251 }
252 }
253
254 public boolean isWriteToWal() {
255 return this.writeToWal;
256 }
257
258 public TIncrement setWriteToWal(boolean writeToWal) {
259 this.writeToWal = writeToWal;
260 setWriteToWalIsSet(true);
261 return this;
262 }
263
264 public void unsetWriteToWal() {
265 __isset_bit_vector.clear(__WRITETOWAL_ISSET_ID);
266 }
267
268
269 public boolean isSetWriteToWal() {
270 return __isset_bit_vector.get(__WRITETOWAL_ISSET_ID);
271 }
272
273 public void setWriteToWalIsSet(boolean value) {
274 __isset_bit_vector.set(__WRITETOWAL_ISSET_ID, value);
275 }
276
277 public void setFieldValue(_Fields field, Object value) {
278 switch (field) {
279 case ROW:
280 if (value == null) {
281 unsetRow();
282 } else {
283 setRow((ByteBuffer)value);
284 }
285 break;
286
287 case COLUMNS:
288 if (value == null) {
289 unsetColumns();
290 } else {
291 setColumns((List<TColumnIncrement>)value);
292 }
293 break;
294
295 case WRITE_TO_WAL:
296 if (value == null) {
297 unsetWriteToWal();
298 } else {
299 setWriteToWal((Boolean)value);
300 }
301 break;
302
303 }
304 }
305
306 public Object getFieldValue(_Fields field) {
307 switch (field) {
308 case ROW:
309 return getRow();
310
311 case COLUMNS:
312 return getColumns();
313
314 case WRITE_TO_WAL:
315 return Boolean.valueOf(isWriteToWal());
316
317 }
318 throw new IllegalStateException();
319 }
320
321
322 public boolean isSet(_Fields field) {
323 if (field == null) {
324 throw new IllegalArgumentException();
325 }
326
327 switch (field) {
328 case ROW:
329 return isSetRow();
330 case COLUMNS:
331 return isSetColumns();
332 case WRITE_TO_WAL:
333 return isSetWriteToWal();
334 }
335 throw new IllegalStateException();
336 }
337
338 @Override
339 public boolean equals(Object that) {
340 if (that == null)
341 return false;
342 if (that instanceof TIncrement)
343 return this.equals((TIncrement)that);
344 return false;
345 }
346
347 public boolean equals(TIncrement that) {
348 if (that == null)
349 return false;
350
351 boolean this_present_row = true && this.isSetRow();
352 boolean that_present_row = true && that.isSetRow();
353 if (this_present_row || that_present_row) {
354 if (!(this_present_row && that_present_row))
355 return false;
356 if (!this.row.equals(that.row))
357 return false;
358 }
359
360 boolean this_present_columns = true && this.isSetColumns();
361 boolean that_present_columns = true && that.isSetColumns();
362 if (this_present_columns || that_present_columns) {
363 if (!(this_present_columns && that_present_columns))
364 return false;
365 if (!this.columns.equals(that.columns))
366 return false;
367 }
368
369 boolean this_present_writeToWal = true && this.isSetWriteToWal();
370 boolean that_present_writeToWal = true && that.isSetWriteToWal();
371 if (this_present_writeToWal || that_present_writeToWal) {
372 if (!(this_present_writeToWal && that_present_writeToWal))
373 return false;
374 if (this.writeToWal != that.writeToWal)
375 return false;
376 }
377
378 return true;
379 }
380
381 @Override
382 public int hashCode() {
383 return 0;
384 }
385
386 public int compareTo(TIncrement other) {
387 if (!getClass().equals(other.getClass())) {
388 return getClass().getName().compareTo(other.getClass().getName());
389 }
390
391 int lastComparison = 0;
392 TIncrement typedOther = (TIncrement)other;
393
394 lastComparison = Boolean.valueOf(isSetRow()).compareTo(typedOther.isSetRow());
395 if (lastComparison != 0) {
396 return lastComparison;
397 }
398 if (isSetRow()) {
399 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.row, typedOther.row);
400 if (lastComparison != 0) {
401 return lastComparison;
402 }
403 }
404 lastComparison = Boolean.valueOf(isSetColumns()).compareTo(typedOther.isSetColumns());
405 if (lastComparison != 0) {
406 return lastComparison;
407 }
408 if (isSetColumns()) {
409 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columns, typedOther.columns);
410 if (lastComparison != 0) {
411 return lastComparison;
412 }
413 }
414 lastComparison = Boolean.valueOf(isSetWriteToWal()).compareTo(typedOther.isSetWriteToWal());
415 if (lastComparison != 0) {
416 return lastComparison;
417 }
418 if (isSetWriteToWal()) {
419 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.writeToWal, typedOther.writeToWal);
420 if (lastComparison != 0) {
421 return lastComparison;
422 }
423 }
424 return 0;
425 }
426
427 public _Fields fieldForId(int fieldId) {
428 return _Fields.findByThriftId(fieldId);
429 }
430
431 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
432 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
433 }
434
435 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
436 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
437 }
438
439 @Override
440 public String toString() {
441 StringBuilder sb = new StringBuilder("TIncrement(");
442 boolean first = true;
443
444 sb.append("row:");
445 if (this.row == null) {
446 sb.append("null");
447 } else {
448 org.apache.thrift.TBaseHelper.toString(this.row, sb);
449 }
450 first = false;
451 if (!first) sb.append(", ");
452 sb.append("columns:");
453 if (this.columns == null) {
454 sb.append("null");
455 } else {
456 sb.append(this.columns);
457 }
458 first = false;
459 if (isSetWriteToWal()) {
460 if (!first) sb.append(", ");
461 sb.append("writeToWal:");
462 sb.append(this.writeToWal);
463 first = false;
464 }
465 sb.append(")");
466 return sb.toString();
467 }
468
469 public void validate() throws org.apache.thrift.TException {
470
471 if (row == null) {
472 throw new org.apache.thrift.protocol.TProtocolException("Required field 'row' was not present! Struct: " + toString());
473 }
474 if (columns == null) {
475 throw new org.apache.thrift.protocol.TProtocolException("Required field 'columns' was not present! Struct: " + toString());
476 }
477 }
478
479 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
480 try {
481 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
482 } catch (org.apache.thrift.TException te) {
483 throw new java.io.IOException(te);
484 }
485 }
486
487 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
488 try {
489
490 __isset_bit_vector = new BitSet(1);
491 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
492 } catch (org.apache.thrift.TException te) {
493 throw new java.io.IOException(te);
494 }
495 }
496
497 private static class TIncrementStandardSchemeFactory implements SchemeFactory {
498 public TIncrementStandardScheme getScheme() {
499 return new TIncrementStandardScheme();
500 }
501 }
502
503 private static class TIncrementStandardScheme extends StandardScheme<TIncrement> {
504
505 public void read(org.apache.thrift.protocol.TProtocol iprot, TIncrement struct) throws org.apache.thrift.TException {
506 org.apache.thrift.protocol.TField schemeField;
507 iprot.readStructBegin();
508 while (true)
509 {
510 schemeField = iprot.readFieldBegin();
511 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
512 break;
513 }
514 switch (schemeField.id) {
515 case 1:
516 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
517 struct.row = iprot.readBinary();
518 struct.setRowIsSet(true);
519 } else {
520 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
521 }
522 break;
523 case 2:
524 if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
525 {
526 org.apache.thrift.protocol.TList _list32 = iprot.readListBegin();
527 struct.columns = new ArrayList<TColumnIncrement>(_list32.size);
528 for (int _i33 = 0; _i33 < _list32.size; ++_i33)
529 {
530 TColumnIncrement _elem34;
531 _elem34 = new TColumnIncrement();
532 _elem34.read(iprot);
533 struct.columns.add(_elem34);
534 }
535 iprot.readListEnd();
536 }
537 struct.setColumnsIsSet(true);
538 } else {
539 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
540 }
541 break;
542 case 3:
543 if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
544 struct.writeToWal = iprot.readBool();
545 struct.setWriteToWalIsSet(true);
546 } else {
547 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
548 }
549 break;
550 default:
551 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
552 }
553 iprot.readFieldEnd();
554 }
555 iprot.readStructEnd();
556
557
558 struct.validate();
559 }
560
561 public void write(org.apache.thrift.protocol.TProtocol oprot, TIncrement struct) throws org.apache.thrift.TException {
562 struct.validate();
563
564 oprot.writeStructBegin(STRUCT_DESC);
565 if (struct.row != null) {
566 oprot.writeFieldBegin(ROW_FIELD_DESC);
567 oprot.writeBinary(struct.row);
568 oprot.writeFieldEnd();
569 }
570 if (struct.columns != null) {
571 oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
572 {
573 oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size()));
574 for (TColumnIncrement _iter35 : struct.columns)
575 {
576 _iter35.write(oprot);
577 }
578 oprot.writeListEnd();
579 }
580 oprot.writeFieldEnd();
581 }
582 if (struct.isSetWriteToWal()) {
583 oprot.writeFieldBegin(WRITE_TO_WAL_FIELD_DESC);
584 oprot.writeBool(struct.writeToWal);
585 oprot.writeFieldEnd();
586 }
587 oprot.writeFieldStop();
588 oprot.writeStructEnd();
589 }
590
591 }
592
593 private static class TIncrementTupleSchemeFactory implements SchemeFactory {
594 public TIncrementTupleScheme getScheme() {
595 return new TIncrementTupleScheme();
596 }
597 }
598
599 private static class TIncrementTupleScheme extends TupleScheme<TIncrement> {
600
601 @Override
602 public void write(org.apache.thrift.protocol.TProtocol prot, TIncrement struct) throws org.apache.thrift.TException {
603 TTupleProtocol oprot = (TTupleProtocol) prot;
604 oprot.writeBinary(struct.row);
605 {
606 oprot.writeI32(struct.columns.size());
607 for (TColumnIncrement _iter36 : struct.columns)
608 {
609 _iter36.write(oprot);
610 }
611 }
612 BitSet optionals = new BitSet();
613 if (struct.isSetWriteToWal()) {
614 optionals.set(0);
615 }
616 oprot.writeBitSet(optionals, 1);
617 if (struct.isSetWriteToWal()) {
618 oprot.writeBool(struct.writeToWal);
619 }
620 }
621
622 @Override
623 public void read(org.apache.thrift.protocol.TProtocol prot, TIncrement struct) throws org.apache.thrift.TException {
624 TTupleProtocol iprot = (TTupleProtocol) prot;
625 struct.row = iprot.readBinary();
626 struct.setRowIsSet(true);
627 {
628 org.apache.thrift.protocol.TList _list37 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
629 struct.columns = new ArrayList<TColumnIncrement>(_list37.size);
630 for (int _i38 = 0; _i38 < _list37.size; ++_i38)
631 {
632 TColumnIncrement _elem39;
633 _elem39 = new TColumnIncrement();
634 _elem39.read(iprot);
635 struct.columns.add(_elem39);
636 }
637 }
638 struct.setColumnsIsSet(true);
639 BitSet incoming = iprot.readBitSet(1);
640 if (incoming.get(0)) {
641 struct.writeToWal = iprot.readBool();
642 struct.setWriteToWalIsSet(true);
643 }
644 }
645 }
646
647 }
648