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