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