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