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