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