1
2
3
4
5
6
7 package org.apache.hadoop.hbase.thrift.generated;
8
9 import org.apache.commons.lang.builder.HashCodeBuilder;
10 import org.apache.thrift.scheme.IScheme;
11 import org.apache.thrift.scheme.SchemeFactory;
12 import org.apache.thrift.scheme.StandardScheme;
13
14 import org.apache.thrift.scheme.TupleScheme;
15 import org.apache.thrift.protocol.TTupleProtocol;
16 import java.util.List;
17 import java.util.ArrayList;
18 import java.util.Map;
19 import java.util.HashMap;
20 import java.util.EnumMap;
21 import java.util.Set;
22 import java.util.HashSet;
23 import java.util.EnumSet;
24 import java.util.Collections;
25 import java.util.BitSet;
26 import java.nio.ByteBuffer;
27 import java.util.Arrays;
28 import org.slf4j.Logger;
29 import org.slf4j.LoggerFactory;
30
31
32
33
34
35 public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncrement._Fields>, java.io.Serializable, Cloneable {
36 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TIncrement");
37
38 private static final org.apache.thrift.protocol.TField TABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("table", org.apache.thrift.protocol.TType.STRING, (short)1);
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)2);
40 private static final org.apache.thrift.protocol.TField COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("column", org.apache.thrift.protocol.TType.STRING, (short)3);
41 private static final org.apache.thrift.protocol.TField AMMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("ammount", org.apache.thrift.protocol.TType.I64, (short)4);
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 table;
50 public ByteBuffer row;
51 public ByteBuffer column;
52 public long ammount;
53
54
55 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
56 TABLE((short)1, "table"),
57 ROW((short)2, "row"),
58 COLUMN((short)3, "column"),
59 AMMOUNT((short)4, "ammount");
60
61 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
62
63 static {
64 for (_Fields field : EnumSet.allOf(_Fields.class)) {
65 byName.put(field.getFieldName(), field);
66 }
67 }
68
69
70
71
72 public static _Fields findByThriftId(int fieldId) {
73 switch(fieldId) {
74 case 1:
75 return TABLE;
76 case 2:
77 return ROW;
78 case 3:
79 return COLUMN;
80 case 4:
81 return AMMOUNT;
82 default:
83 return null;
84 }
85 }
86
87
88
89
90
91 public static _Fields findByThriftIdOrThrow(int fieldId) {
92 _Fields fields = findByThriftId(fieldId);
93 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
94 return fields;
95 }
96
97
98
99
100 public static _Fields findByName(String name) {
101 return byName.get(name);
102 }
103
104 private final short _thriftId;
105 private final String _fieldName;
106
107 _Fields(short thriftId, String fieldName) {
108 _thriftId = thriftId;
109 _fieldName = fieldName;
110 }
111
112 public short getThriftFieldId() {
113 return _thriftId;
114 }
115
116 public String getFieldName() {
117 return _fieldName;
118 }
119 }
120
121
122 private static final int __AMMOUNT_ISSET_ID = 0;
123 private BitSet __isset_bit_vector = new BitSet(1);
124 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
125 static {
126 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
127 tmpMap.put(_Fields.TABLE, new org.apache.thrift.meta_data.FieldMetaData("table", org.apache.thrift.TFieldRequirementType.DEFAULT,
128 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text")));
129 tmpMap.put(_Fields.ROW, new org.apache.thrift.meta_data.FieldMetaData("row", org.apache.thrift.TFieldRequirementType.DEFAULT,
130 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text")));
131 tmpMap.put(_Fields.COLUMN, new org.apache.thrift.meta_data.FieldMetaData("column", org.apache.thrift.TFieldRequirementType.DEFAULT,
132 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Text")));
133 tmpMap.put(_Fields.AMMOUNT, new org.apache.thrift.meta_data.FieldMetaData("ammount", org.apache.thrift.TFieldRequirementType.DEFAULT,
134 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
135 metaDataMap = Collections.unmodifiableMap(tmpMap);
136 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TIncrement.class, metaDataMap);
137 }
138
139 public TIncrement() {
140 }
141
142 public TIncrement(
143 ByteBuffer table,
144 ByteBuffer row,
145 ByteBuffer column,
146 long ammount)
147 {
148 this();
149 this.table = table;
150 this.row = row;
151 this.column = column;
152 this.ammount = ammount;
153 setAmmountIsSet(true);
154 }
155
156
157
158
159 public TIncrement(TIncrement other) {
160 __isset_bit_vector.clear();
161 __isset_bit_vector.or(other.__isset_bit_vector);
162 if (other.isSetTable()) {
163 this.table = other.table;
164 }
165 if (other.isSetRow()) {
166 this.row = other.row;
167 }
168 if (other.isSetColumn()) {
169 this.column = other.column;
170 }
171 this.ammount = other.ammount;
172 }
173
174 public TIncrement deepCopy() {
175 return new TIncrement(this);
176 }
177
178 @Override
179 public void clear() {
180 this.table = null;
181 this.row = null;
182 this.column = null;
183 setAmmountIsSet(false);
184 this.ammount = 0;
185 }
186
187 public byte[] getTable() {
188 setTable(org.apache.thrift.TBaseHelper.rightSize(table));
189 return table == null ? null : table.array();
190 }
191
192 public ByteBuffer bufferForTable() {
193 return table;
194 }
195
196 public TIncrement setTable(byte[] table) {
197 setTable(table == null ? (ByteBuffer)null : ByteBuffer.wrap(table));
198 return this;
199 }
200
201 public TIncrement setTable(ByteBuffer table) {
202 this.table = table;
203 return this;
204 }
205
206 public void unsetTable() {
207 this.table = null;
208 }
209
210
211 public boolean isSetTable() {
212 return this.table != null;
213 }
214
215 public void setTableIsSet(boolean value) {
216 if (!value) {
217 this.table = null;
218 }
219 }
220
221 public byte[] getRow() {
222 setRow(org.apache.thrift.TBaseHelper.rightSize(row));
223 return row == null ? null : row.array();
224 }
225
226 public ByteBuffer bufferForRow() {
227 return row;
228 }
229
230 public TIncrement setRow(byte[] row) {
231 setRow(row == null ? (ByteBuffer)null : ByteBuffer.wrap(row));
232 return this;
233 }
234
235 public TIncrement setRow(ByteBuffer row) {
236 this.row = row;
237 return this;
238 }
239
240 public void unsetRow() {
241 this.row = null;
242 }
243
244
245 public boolean isSetRow() {
246 return this.row != null;
247 }
248
249 public void setRowIsSet(boolean value) {
250 if (!value) {
251 this.row = null;
252 }
253 }
254
255 public byte[] getColumn() {
256 setColumn(org.apache.thrift.TBaseHelper.rightSize(column));
257 return column == null ? null : column.array();
258 }
259
260 public ByteBuffer bufferForColumn() {
261 return column;
262 }
263
264 public TIncrement setColumn(byte[] column) {
265 setColumn(column == null ? (ByteBuffer)null : ByteBuffer.wrap(column));
266 return this;
267 }
268
269 public TIncrement setColumn(ByteBuffer column) {
270 this.column = column;
271 return this;
272 }
273
274 public void unsetColumn() {
275 this.column = null;
276 }
277
278
279 public boolean isSetColumn() {
280 return this.column != null;
281 }
282
283 public void setColumnIsSet(boolean value) {
284 if (!value) {
285 this.column = null;
286 }
287 }
288
289 public long getAmmount() {
290 return this.ammount;
291 }
292
293 public TIncrement setAmmount(long ammount) {
294 this.ammount = ammount;
295 setAmmountIsSet(true);
296 return this;
297 }
298
299 public void unsetAmmount() {
300 __isset_bit_vector.clear(__AMMOUNT_ISSET_ID);
301 }
302
303
304 public boolean isSetAmmount() {
305 return __isset_bit_vector.get(__AMMOUNT_ISSET_ID);
306 }
307
308 public void setAmmountIsSet(boolean value) {
309 __isset_bit_vector.set(__AMMOUNT_ISSET_ID, value);
310 }
311
312 public void setFieldValue(_Fields field, Object value) {
313 switch (field) {
314 case TABLE:
315 if (value == null) {
316 unsetTable();
317 } else {
318 setTable((ByteBuffer)value);
319 }
320 break;
321
322 case ROW:
323 if (value == null) {
324 unsetRow();
325 } else {
326 setRow((ByteBuffer)value);
327 }
328 break;
329
330 case COLUMN:
331 if (value == null) {
332 unsetColumn();
333 } else {
334 setColumn((ByteBuffer)value);
335 }
336 break;
337
338 case AMMOUNT:
339 if (value == null) {
340 unsetAmmount();
341 } else {
342 setAmmount((Long)value);
343 }
344 break;
345
346 }
347 }
348
349 public Object getFieldValue(_Fields field) {
350 switch (field) {
351 case TABLE:
352 return getTable();
353
354 case ROW:
355 return getRow();
356
357 case COLUMN:
358 return getColumn();
359
360 case AMMOUNT:
361 return Long.valueOf(getAmmount());
362
363 }
364 throw new IllegalStateException();
365 }
366
367
368 public boolean isSet(_Fields field) {
369 if (field == null) {
370 throw new IllegalArgumentException();
371 }
372
373 switch (field) {
374 case TABLE:
375 return isSetTable();
376 case ROW:
377 return isSetRow();
378 case COLUMN:
379 return isSetColumn();
380 case AMMOUNT:
381 return isSetAmmount();
382 }
383 throw new IllegalStateException();
384 }
385
386 @Override
387 public boolean equals(Object that) {
388 if (that == null)
389 return false;
390 if (that instanceof TIncrement)
391 return this.equals((TIncrement)that);
392 return false;
393 }
394
395 public boolean equals(TIncrement that) {
396 if (that == null)
397 return false;
398
399 boolean this_present_table = true && this.isSetTable();
400 boolean that_present_table = true && that.isSetTable();
401 if (this_present_table || that_present_table) {
402 if (!(this_present_table && that_present_table))
403 return false;
404 if (!this.table.equals(that.table))
405 return false;
406 }
407
408 boolean this_present_row = true && this.isSetRow();
409 boolean that_present_row = true && that.isSetRow();
410 if (this_present_row || that_present_row) {
411 if (!(this_present_row && that_present_row))
412 return false;
413 if (!this.row.equals(that.row))
414 return false;
415 }
416
417 boolean this_present_column = true && this.isSetColumn();
418 boolean that_present_column = true && that.isSetColumn();
419 if (this_present_column || that_present_column) {
420 if (!(this_present_column && that_present_column))
421 return false;
422 if (!this.column.equals(that.column))
423 return false;
424 }
425
426 boolean this_present_ammount = true;
427 boolean that_present_ammount = true;
428 if (this_present_ammount || that_present_ammount) {
429 if (!(this_present_ammount && that_present_ammount))
430 return false;
431 if (this.ammount != that.ammount)
432 return false;
433 }
434
435 return true;
436 }
437
438 @Override
439 public int hashCode() {
440 HashCodeBuilder builder = new HashCodeBuilder();
441
442 boolean present_table = true && (isSetTable());
443 builder.append(present_table);
444 if (present_table)
445 builder.append(table);
446
447 boolean present_row = true && (isSetRow());
448 builder.append(present_row);
449 if (present_row)
450 builder.append(row);
451
452 boolean present_column = true && (isSetColumn());
453 builder.append(present_column);
454 if (present_column)
455 builder.append(column);
456
457 boolean present_ammount = true;
458 builder.append(present_ammount);
459 if (present_ammount)
460 builder.append(ammount);
461
462 return builder.toHashCode();
463 }
464
465 public int compareTo(TIncrement other) {
466 if (!getClass().equals(other.getClass())) {
467 return getClass().getName().compareTo(other.getClass().getName());
468 }
469
470 int lastComparison = 0;
471 TIncrement typedOther = (TIncrement)other;
472
473 lastComparison = Boolean.valueOf(isSetTable()).compareTo(typedOther.isSetTable());
474 if (lastComparison != 0) {
475 return lastComparison;
476 }
477 if (isSetTable()) {
478 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.table, typedOther.table);
479 if (lastComparison != 0) {
480 return lastComparison;
481 }
482 }
483 lastComparison = Boolean.valueOf(isSetRow()).compareTo(typedOther.isSetRow());
484 if (lastComparison != 0) {
485 return lastComparison;
486 }
487 if (isSetRow()) {
488 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.row, typedOther.row);
489 if (lastComparison != 0) {
490 return lastComparison;
491 }
492 }
493 lastComparison = Boolean.valueOf(isSetColumn()).compareTo(typedOther.isSetColumn());
494 if (lastComparison != 0) {
495 return lastComparison;
496 }
497 if (isSetColumn()) {
498 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.column, typedOther.column);
499 if (lastComparison != 0) {
500 return lastComparison;
501 }
502 }
503 lastComparison = Boolean.valueOf(isSetAmmount()).compareTo(typedOther.isSetAmmount());
504 if (lastComparison != 0) {
505 return lastComparison;
506 }
507 if (isSetAmmount()) {
508 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ammount, typedOther.ammount);
509 if (lastComparison != 0) {
510 return lastComparison;
511 }
512 }
513 return 0;
514 }
515
516 public _Fields fieldForId(int fieldId) {
517 return _Fields.findByThriftId(fieldId);
518 }
519
520 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
521 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
522 }
523
524 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
525 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
526 }
527
528 @Override
529 public String toString() {
530 StringBuilder sb = new StringBuilder("TIncrement(");
531 boolean first = true;
532
533 sb.append("table:");
534 if (this.table == null) {
535 sb.append("null");
536 } else {
537 sb.append(this.table);
538 }
539 first = false;
540 if (!first) sb.append(", ");
541 sb.append("row:");
542 if (this.row == null) {
543 sb.append("null");
544 } else {
545 sb.append(this.row);
546 }
547 first = false;
548 if (!first) sb.append(", ");
549 sb.append("column:");
550 if (this.column == null) {
551 sb.append("null");
552 } else {
553 sb.append(this.column);
554 }
555 first = false;
556 if (!first) sb.append(", ");
557 sb.append("ammount:");
558 sb.append(this.ammount);
559 first = false;
560 sb.append(")");
561 return sb.toString();
562 }
563
564 public void validate() throws org.apache.thrift.TException {
565
566 }
567
568 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
569 try {
570 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
571 } catch (org.apache.thrift.TException te) {
572 throw new java.io.IOException(te);
573 }
574 }
575
576 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
577 try {
578
579 __isset_bit_vector = new BitSet(1);
580 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
581 } catch (org.apache.thrift.TException te) {
582 throw new java.io.IOException(te);
583 }
584 }
585
586 private static class TIncrementStandardSchemeFactory implements SchemeFactory {
587 public TIncrementStandardScheme getScheme() {
588 return new TIncrementStandardScheme();
589 }
590 }
591
592 private static class TIncrementStandardScheme extends StandardScheme<TIncrement> {
593
594 public void read(org.apache.thrift.protocol.TProtocol iprot, TIncrement struct) throws org.apache.thrift.TException {
595 org.apache.thrift.protocol.TField schemeField;
596 iprot.readStructBegin();
597 while (true)
598 {
599 schemeField = iprot.readFieldBegin();
600 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
601 break;
602 }
603 switch (schemeField.id) {
604 case 1:
605 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
606 struct.table = iprot.readBinary();
607 struct.setTableIsSet(true);
608 } else {
609 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
610 }
611 break;
612 case 2:
613 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
614 struct.row = iprot.readBinary();
615 struct.setRowIsSet(true);
616 } else {
617 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
618 }
619 break;
620 case 3:
621 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
622 struct.column = iprot.readBinary();
623 struct.setColumnIsSet(true);
624 } else {
625 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
626 }
627 break;
628 case 4:
629 if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
630 struct.ammount = iprot.readI64();
631 struct.setAmmountIsSet(true);
632 } else {
633 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
634 }
635 break;
636 default:
637 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
638 }
639 iprot.readFieldEnd();
640 }
641 iprot.readStructEnd();
642
643
644 struct.validate();
645 }
646
647 public void write(org.apache.thrift.protocol.TProtocol oprot, TIncrement struct) throws org.apache.thrift.TException {
648 struct.validate();
649
650 oprot.writeStructBegin(STRUCT_DESC);
651 if (struct.table != null) {
652 oprot.writeFieldBegin(TABLE_FIELD_DESC);
653 oprot.writeBinary(struct.table);
654 oprot.writeFieldEnd();
655 }
656 if (struct.row != null) {
657 oprot.writeFieldBegin(ROW_FIELD_DESC);
658 oprot.writeBinary(struct.row);
659 oprot.writeFieldEnd();
660 }
661 if (struct.column != null) {
662 oprot.writeFieldBegin(COLUMN_FIELD_DESC);
663 oprot.writeBinary(struct.column);
664 oprot.writeFieldEnd();
665 }
666 oprot.writeFieldBegin(AMMOUNT_FIELD_DESC);
667 oprot.writeI64(struct.ammount);
668 oprot.writeFieldEnd();
669 oprot.writeFieldStop();
670 oprot.writeStructEnd();
671 }
672
673 }
674
675 private static class TIncrementTupleSchemeFactory implements SchemeFactory {
676 public TIncrementTupleScheme getScheme() {
677 return new TIncrementTupleScheme();
678 }
679 }
680
681 private static class TIncrementTupleScheme extends TupleScheme<TIncrement> {
682
683 @Override
684 public void write(org.apache.thrift.protocol.TProtocol prot, TIncrement struct) throws org.apache.thrift.TException {
685 TTupleProtocol oprot = (TTupleProtocol) prot;
686 BitSet optionals = new BitSet();
687 if (struct.isSetTable()) {
688 optionals.set(0);
689 }
690 if (struct.isSetRow()) {
691 optionals.set(1);
692 }
693 if (struct.isSetColumn()) {
694 optionals.set(2);
695 }
696 if (struct.isSetAmmount()) {
697 optionals.set(3);
698 }
699 oprot.writeBitSet(optionals, 4);
700 if (struct.isSetTable()) {
701 oprot.writeBinary(struct.table);
702 }
703 if (struct.isSetRow()) {
704 oprot.writeBinary(struct.row);
705 }
706 if (struct.isSetColumn()) {
707 oprot.writeBinary(struct.column);
708 }
709 if (struct.isSetAmmount()) {
710 oprot.writeI64(struct.ammount);
711 }
712 }
713
714 @Override
715 public void read(org.apache.thrift.protocol.TProtocol prot, TIncrement struct) throws org.apache.thrift.TException {
716 TTupleProtocol iprot = (TTupleProtocol) prot;
717 BitSet incoming = iprot.readBitSet(4);
718 if (incoming.get(0)) {
719 struct.table = iprot.readBinary();
720 struct.setTableIsSet(true);
721 }
722 if (incoming.get(1)) {
723 struct.row = iprot.readBinary();
724 struct.setRowIsSet(true);
725 }
726 if (incoming.get(2)) {
727 struct.column = iprot.readBinary();
728 struct.setColumnIsSet(true);
729 }
730 if (incoming.get(3)) {
731 struct.ammount = iprot.readI64();
732 struct.setAmmountIsSet(true);
733 }
734 }
735 }
736
737 }
738