View Javadoc

1   /**
2    * Autogenerated by Thrift Compiler (0.8.0)
3    *
4    * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5    *  @generated
6    */
7   package org.apache.hadoop.hbase.thrift.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   * A TRegionInfo contains information about an HTable region.
33   */
34  public class TRegionInfo implements org.apache.thrift.TBase<TRegionInfo, TRegionInfo._Fields>, java.io.Serializable, Cloneable {
35    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRegionInfo");
36  
37    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);
38    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);
39    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);
40    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);
41    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);
42    private static final org.apache.thrift.protocol.TField SERVER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("serverName", org.apache.thrift.protocol.TType.STRING, (short)6);
43    private static final org.apache.thrift.protocol.TField PORT_FIELD_DESC = new org.apache.thrift.protocol.TField("port", org.apache.thrift.protocol.TType.I32, (short)7);
44  
45    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
46    static {
47      schemes.put(StandardScheme.class, new TRegionInfoStandardSchemeFactory());
48      schemes.put(TupleScheme.class, new TRegionInfoTupleSchemeFactory());
49    }
50  
51    public ByteBuffer startKey; // required
52    public ByteBuffer endKey; // required
53    public long id; // required
54    public ByteBuffer name; // required
55    public byte version; // required
56    public ByteBuffer serverName; // required
57    public int port; // required
58  
59    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
60    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
61      START_KEY((short)1, "startKey"),
62      END_KEY((short)2, "endKey"),
63      ID((short)3, "id"),
64      NAME((short)4, "name"),
65      VERSION((short)5, "version"),
66      SERVER_NAME((short)6, "serverName"),
67      PORT((short)7, "port");
68  
69      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
70  
71      static {
72        for (_Fields field : EnumSet.allOf(_Fields.class)) {
73          byName.put(field.getFieldName(), field);
74        }
75      }
76  
77      /**
78       * Find the _Fields constant that matches fieldId, or null if its not found.
79       */
80      public static _Fields findByThriftId(int fieldId) {
81        switch(fieldId) {
82          case 1: // START_KEY
83            return START_KEY;
84          case 2: // END_KEY
85            return END_KEY;
86          case 3: // ID
87            return ID;
88          case 4: // NAME
89            return NAME;
90          case 5: // VERSION
91            return VERSION;
92          case 6: // SERVER_NAME
93            return SERVER_NAME;
94          case 7: // PORT
95            return PORT;
96          default:
97            return null;
98        }
99      }
100 
101     /**
102      * Find the _Fields constant that matches fieldId, throwing an exception
103      * if it is not found.
104      */
105     public static _Fields findByThriftIdOrThrow(int fieldId) {
106       _Fields fields = findByThriftId(fieldId);
107       if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
108       return fields;
109     }
110 
111     /**
112      * Find the _Fields constant that matches name, or null if its not found.
113      */
114     public static _Fields findByName(String name) {
115       return byName.get(name);
116     }
117 
118     private final short _thriftId;
119     private final String _fieldName;
120 
121     _Fields(short thriftId, String fieldName) {
122       _thriftId = thriftId;
123       _fieldName = fieldName;
124     }
125 
126     public short getThriftFieldId() {
127       return _thriftId;
128     }
129 
130     public String getFieldName() {
131       return _fieldName;
132     }
133   }
134 
135   // isset id assignments
136   private static final int __ID_ISSET_ID = 0;
137   private static final int __VERSION_ISSET_ID = 1;
138   private static final int __PORT_ISSET_ID = 2;
139   private BitSet __isset_bit_vector = new BitSet(3);
140   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
141   static {
142     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
143     tmpMap.put(_Fields.START_KEY, new org.apache.thrift.meta_data.FieldMetaData("startKey", org.apache.thrift.TFieldRequirementType.DEFAULT, 
144         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , "Text")));
145     tmpMap.put(_Fields.END_KEY, new org.apache.thrift.meta_data.FieldMetaData("endKey", org.apache.thrift.TFieldRequirementType.DEFAULT, 
146         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , "Text")));
147     tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
148         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
149     tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
150         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , "Text")));
151     tmpMap.put(_Fields.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.DEFAULT, 
152         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE)));
153     tmpMap.put(_Fields.SERVER_NAME, new org.apache.thrift.meta_data.FieldMetaData("serverName", org.apache.thrift.TFieldRequirementType.DEFAULT, 
154         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , "Text")));
155     tmpMap.put(_Fields.PORT, new org.apache.thrift.meta_data.FieldMetaData("port", org.apache.thrift.TFieldRequirementType.DEFAULT, 
156         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
157     metaDataMap = Collections.unmodifiableMap(tmpMap);
158     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TRegionInfo.class, metaDataMap);
159   }
160 
161   public TRegionInfo() {
162   }
163 
164   public TRegionInfo(
165     ByteBuffer startKey,
166     ByteBuffer endKey,
167     long id,
168     ByteBuffer name,
169     byte version,
170     ByteBuffer serverName,
171     int port)
172   {
173     this();
174     this.startKey = startKey;
175     this.endKey = endKey;
176     this.id = id;
177     setIdIsSet(true);
178     this.name = name;
179     this.version = version;
180     setVersionIsSet(true);
181     this.serverName = serverName;
182     this.port = port;
183     setPortIsSet(true);
184   }
185 
186   /**
187    * Performs a deep copy on <i>other</i>.
188    */
189   public TRegionInfo(TRegionInfo other) {
190     __isset_bit_vector.clear();
191     __isset_bit_vector.or(other.__isset_bit_vector);
192     if (other.isSetStartKey()) {
193       this.startKey = other.startKey;
194     }
195     if (other.isSetEndKey()) {
196       this.endKey = other.endKey;
197     }
198     this.id = other.id;
199     if (other.isSetName()) {
200       this.name = other.name;
201     }
202     this.version = other.version;
203     if (other.isSetServerName()) {
204       this.serverName = other.serverName;
205     }
206     this.port = other.port;
207   }
208 
209   public TRegionInfo deepCopy() {
210     return new TRegionInfo(this);
211   }
212 
213   @Override
214   public void clear() {
215     this.startKey = null;
216     this.endKey = null;
217     setIdIsSet(false);
218     this.id = 0;
219     this.name = null;
220     setVersionIsSet(false);
221     this.version = 0;
222     this.serverName = null;
223     setPortIsSet(false);
224     this.port = 0;
225   }
226 
227   public byte[] getStartKey() {
228     setStartKey(org.apache.thrift.TBaseHelper.rightSize(startKey));
229     return startKey == null ? null : startKey.array();
230   }
231 
232   public ByteBuffer bufferForStartKey() {
233     return startKey;
234   }
235 
236   public TRegionInfo setStartKey(byte[] startKey) {
237     setStartKey(startKey == null ? (ByteBuffer)null : ByteBuffer.wrap(startKey));
238     return this;
239   }
240 
241   public TRegionInfo setStartKey(ByteBuffer startKey) {
242     this.startKey = startKey;
243     return this;
244   }
245 
246   public void unsetStartKey() {
247     this.startKey = null;
248   }
249 
250   /** Returns true if field startKey is set (has been assigned a value) and false otherwise */
251   public boolean isSetStartKey() {
252     return this.startKey != null;
253   }
254 
255   public void setStartKeyIsSet(boolean value) {
256     if (!value) {
257       this.startKey = null;
258     }
259   }
260 
261   public byte[] getEndKey() {
262     setEndKey(org.apache.thrift.TBaseHelper.rightSize(endKey));
263     return endKey == null ? null : endKey.array();
264   }
265 
266   public ByteBuffer bufferForEndKey() {
267     return endKey;
268   }
269 
270   public TRegionInfo setEndKey(byte[] endKey) {
271     setEndKey(endKey == null ? (ByteBuffer)null : ByteBuffer.wrap(endKey));
272     return this;
273   }
274 
275   public TRegionInfo setEndKey(ByteBuffer endKey) {
276     this.endKey = endKey;
277     return this;
278   }
279 
280   public void unsetEndKey() {
281     this.endKey = null;
282   }
283 
284   /** Returns true if field endKey is set (has been assigned a value) and false otherwise */
285   public boolean isSetEndKey() {
286     return this.endKey != null;
287   }
288 
289   public void setEndKeyIsSet(boolean value) {
290     if (!value) {
291       this.endKey = null;
292     }
293   }
294 
295   public long getId() {
296     return this.id;
297   }
298 
299   public TRegionInfo setId(long id) {
300     this.id = id;
301     setIdIsSet(true);
302     return this;
303   }
304 
305   public void unsetId() {
306     __isset_bit_vector.clear(__ID_ISSET_ID);
307   }
308 
309   /** Returns true if field id is set (has been assigned a value) and false otherwise */
310   public boolean isSetId() {
311     return __isset_bit_vector.get(__ID_ISSET_ID);
312   }
313 
314   public void setIdIsSet(boolean value) {
315     __isset_bit_vector.set(__ID_ISSET_ID, value);
316   }
317 
318   public byte[] getName() {
319     setName(org.apache.thrift.TBaseHelper.rightSize(name));
320     return name == null ? null : name.array();
321   }
322 
323   public ByteBuffer bufferForName() {
324     return name;
325   }
326 
327   public TRegionInfo setName(byte[] name) {
328     setName(name == null ? (ByteBuffer)null : ByteBuffer.wrap(name));
329     return this;
330   }
331 
332   public TRegionInfo setName(ByteBuffer name) {
333     this.name = name;
334     return this;
335   }
336 
337   public void unsetName() {
338     this.name = null;
339   }
340 
341   /** Returns true if field name is set (has been assigned a value) and false otherwise */
342   public boolean isSetName() {
343     return this.name != null;
344   }
345 
346   public void setNameIsSet(boolean value) {
347     if (!value) {
348       this.name = null;
349     }
350   }
351 
352   public byte getVersion() {
353     return this.version;
354   }
355 
356   public TRegionInfo setVersion(byte version) {
357     this.version = version;
358     setVersionIsSet(true);
359     return this;
360   }
361 
362   public void unsetVersion() {
363     __isset_bit_vector.clear(__VERSION_ISSET_ID);
364   }
365 
366   /** Returns true if field version is set (has been assigned a value) and false otherwise */
367   public boolean isSetVersion() {
368     return __isset_bit_vector.get(__VERSION_ISSET_ID);
369   }
370 
371   public void setVersionIsSet(boolean value) {
372     __isset_bit_vector.set(__VERSION_ISSET_ID, value);
373   }
374 
375   public byte[] getServerName() {
376     setServerName(org.apache.thrift.TBaseHelper.rightSize(serverName));
377     return serverName == null ? null : serverName.array();
378   }
379 
380   public ByteBuffer bufferForServerName() {
381     return serverName;
382   }
383 
384   public TRegionInfo setServerName(byte[] serverName) {
385     setServerName(serverName == null ? (ByteBuffer)null : ByteBuffer.wrap(serverName));
386     return this;
387   }
388 
389   public TRegionInfo setServerName(ByteBuffer serverName) {
390     this.serverName = serverName;
391     return this;
392   }
393 
394   public void unsetServerName() {
395     this.serverName = null;
396   }
397 
398   /** Returns true if field serverName is set (has been assigned a value) and false otherwise */
399   public boolean isSetServerName() {
400     return this.serverName != null;
401   }
402 
403   public void setServerNameIsSet(boolean value) {
404     if (!value) {
405       this.serverName = null;
406     }
407   }
408 
409   public int getPort() {
410     return this.port;
411   }
412 
413   public TRegionInfo setPort(int port) {
414     this.port = port;
415     setPortIsSet(true);
416     return this;
417   }
418 
419   public void unsetPort() {
420     __isset_bit_vector.clear(__PORT_ISSET_ID);
421   }
422 
423   /** Returns true if field port is set (has been assigned a value) and false otherwise */
424   public boolean isSetPort() {
425     return __isset_bit_vector.get(__PORT_ISSET_ID);
426   }
427 
428   public void setPortIsSet(boolean value) {
429     __isset_bit_vector.set(__PORT_ISSET_ID, value);
430   }
431 
432   public void setFieldValue(_Fields field, Object value) {
433     switch (field) {
434     case START_KEY:
435       if (value == null) {
436         unsetStartKey();
437       } else {
438         setStartKey((ByteBuffer)value);
439       }
440       break;
441 
442     case END_KEY:
443       if (value == null) {
444         unsetEndKey();
445       } else {
446         setEndKey((ByteBuffer)value);
447       }
448       break;
449 
450     case ID:
451       if (value == null) {
452         unsetId();
453       } else {
454         setId((Long)value);
455       }
456       break;
457 
458     case NAME:
459       if (value == null) {
460         unsetName();
461       } else {
462         setName((ByteBuffer)value);
463       }
464       break;
465 
466     case VERSION:
467       if (value == null) {
468         unsetVersion();
469       } else {
470         setVersion((Byte)value);
471       }
472       break;
473 
474     case SERVER_NAME:
475       if (value == null) {
476         unsetServerName();
477       } else {
478         setServerName((ByteBuffer)value);
479       }
480       break;
481 
482     case PORT:
483       if (value == null) {
484         unsetPort();
485       } else {
486         setPort((Integer)value);
487       }
488       break;
489 
490     }
491   }
492 
493   public Object getFieldValue(_Fields field) {
494     switch (field) {
495     case START_KEY:
496       return getStartKey();
497 
498     case END_KEY:
499       return getEndKey();
500 
501     case ID:
502       return Long.valueOf(getId());
503 
504     case NAME:
505       return getName();
506 
507     case VERSION:
508       return Byte.valueOf(getVersion());
509 
510     case SERVER_NAME:
511       return getServerName();
512 
513     case PORT:
514       return Integer.valueOf(getPort());
515 
516     }
517     throw new IllegalStateException();
518   }
519 
520   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
521   public boolean isSet(_Fields field) {
522     if (field == null) {
523       throw new IllegalArgumentException();
524     }
525 
526     switch (field) {
527     case START_KEY:
528       return isSetStartKey();
529     case END_KEY:
530       return isSetEndKey();
531     case ID:
532       return isSetId();
533     case NAME:
534       return isSetName();
535     case VERSION:
536       return isSetVersion();
537     case SERVER_NAME:
538       return isSetServerName();
539     case PORT:
540       return isSetPort();
541     }
542     throw new IllegalStateException();
543   }
544 
545   @Override
546   public boolean equals(Object that) {
547     if (that == null)
548       return false;
549     if (that instanceof TRegionInfo)
550       return this.equals((TRegionInfo)that);
551     return false;
552   }
553 
554   public boolean equals(TRegionInfo that) {
555     if (that == null)
556       return false;
557 
558     boolean this_present_startKey = true && this.isSetStartKey();
559     boolean that_present_startKey = true && that.isSetStartKey();
560     if (this_present_startKey || that_present_startKey) {
561       if (!(this_present_startKey && that_present_startKey))
562         return false;
563       if (!this.startKey.equals(that.startKey))
564         return false;
565     }
566 
567     boolean this_present_endKey = true && this.isSetEndKey();
568     boolean that_present_endKey = true && that.isSetEndKey();
569     if (this_present_endKey || that_present_endKey) {
570       if (!(this_present_endKey && that_present_endKey))
571         return false;
572       if (!this.endKey.equals(that.endKey))
573         return false;
574     }
575 
576     boolean this_present_id = true;
577     boolean that_present_id = true;
578     if (this_present_id || that_present_id) {
579       if (!(this_present_id && that_present_id))
580         return false;
581       if (this.id != that.id)
582         return false;
583     }
584 
585     boolean this_present_name = true && this.isSetName();
586     boolean that_present_name = true && that.isSetName();
587     if (this_present_name || that_present_name) {
588       if (!(this_present_name && that_present_name))
589         return false;
590       if (!this.name.equals(that.name))
591         return false;
592     }
593 
594     boolean this_present_version = true;
595     boolean that_present_version = true;
596     if (this_present_version || that_present_version) {
597       if (!(this_present_version && that_present_version))
598         return false;
599       if (this.version != that.version)
600         return false;
601     }
602 
603     boolean this_present_serverName = true && this.isSetServerName();
604     boolean that_present_serverName = true && that.isSetServerName();
605     if (this_present_serverName || that_present_serverName) {
606       if (!(this_present_serverName && that_present_serverName))
607         return false;
608       if (!this.serverName.equals(that.serverName))
609         return false;
610     }
611 
612     boolean this_present_port = true;
613     boolean that_present_port = true;
614     if (this_present_port || that_present_port) {
615       if (!(this_present_port && that_present_port))
616         return false;
617       if (this.port != that.port)
618         return false;
619     }
620 
621     return true;
622   }
623 
624   @Override
625   public int hashCode() {
626     HashCodeBuilder builder = new HashCodeBuilder();
627 
628     boolean present_startKey = true && (isSetStartKey());
629     builder.append(present_startKey);
630     if (present_startKey)
631       builder.append(startKey);
632 
633     boolean present_endKey = true && (isSetEndKey());
634     builder.append(present_endKey);
635     if (present_endKey)
636       builder.append(endKey);
637 
638     boolean present_id = true;
639     builder.append(present_id);
640     if (present_id)
641       builder.append(id);
642 
643     boolean present_name = true && (isSetName());
644     builder.append(present_name);
645     if (present_name)
646       builder.append(name);
647 
648     boolean present_version = true;
649     builder.append(present_version);
650     if (present_version)
651       builder.append(version);
652 
653     boolean present_serverName = true && (isSetServerName());
654     builder.append(present_serverName);
655     if (present_serverName)
656       builder.append(serverName);
657 
658     boolean present_port = true;
659     builder.append(present_port);
660     if (present_port)
661       builder.append(port);
662 
663     return builder.toHashCode();
664   }
665 
666   public int compareTo(TRegionInfo other) {
667     if (!getClass().equals(other.getClass())) {
668       return getClass().getName().compareTo(other.getClass().getName());
669     }
670 
671     int lastComparison = 0;
672     TRegionInfo typedOther = (TRegionInfo)other;
673 
674     lastComparison = Boolean.valueOf(isSetStartKey()).compareTo(typedOther.isSetStartKey());
675     if (lastComparison != 0) {
676       return lastComparison;
677     }
678     if (isSetStartKey()) {
679       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.startKey, typedOther.startKey);
680       if (lastComparison != 0) {
681         return lastComparison;
682       }
683     }
684     lastComparison = Boolean.valueOf(isSetEndKey()).compareTo(typedOther.isSetEndKey());
685     if (lastComparison != 0) {
686       return lastComparison;
687     }
688     if (isSetEndKey()) {
689       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.endKey, typedOther.endKey);
690       if (lastComparison != 0) {
691         return lastComparison;
692       }
693     }
694     lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
695     if (lastComparison != 0) {
696       return lastComparison;
697     }
698     if (isSetId()) {
699       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
700       if (lastComparison != 0) {
701         return lastComparison;
702       }
703     }
704     lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName());
705     if (lastComparison != 0) {
706       return lastComparison;
707     }
708     if (isSetName()) {
709       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name);
710       if (lastComparison != 0) {
711         return lastComparison;
712       }
713     }
714     lastComparison = Boolean.valueOf(isSetVersion()).compareTo(typedOther.isSetVersion());
715     if (lastComparison != 0) {
716       return lastComparison;
717     }
718     if (isSetVersion()) {
719       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.version, typedOther.version);
720       if (lastComparison != 0) {
721         return lastComparison;
722       }
723     }
724     lastComparison = Boolean.valueOf(isSetServerName()).compareTo(typedOther.isSetServerName());
725     if (lastComparison != 0) {
726       return lastComparison;
727     }
728     if (isSetServerName()) {
729       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serverName, typedOther.serverName);
730       if (lastComparison != 0) {
731         return lastComparison;
732       }
733     }
734     lastComparison = Boolean.valueOf(isSetPort()).compareTo(typedOther.isSetPort());
735     if (lastComparison != 0) {
736       return lastComparison;
737     }
738     if (isSetPort()) {
739       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.port, typedOther.port);
740       if (lastComparison != 0) {
741         return lastComparison;
742       }
743     }
744     return 0;
745   }
746 
747   public _Fields fieldForId(int fieldId) {
748     return _Fields.findByThriftId(fieldId);
749   }
750 
751   public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
752     schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
753   }
754 
755   public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
756     schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
757   }
758 
759   @Override
760   public String toString() {
761     StringBuilder sb = new StringBuilder("TRegionInfo(");
762     boolean first = true;
763 
764     sb.append("startKey:");
765     if (this.startKey == null) {
766       sb.append("null");
767     } else {
768       sb.append(this.startKey);
769     }
770     first = false;
771     if (!first) sb.append(", ");
772     sb.append("endKey:");
773     if (this.endKey == null) {
774       sb.append("null");
775     } else {
776       sb.append(this.endKey);
777     }
778     first = false;
779     if (!first) sb.append(", ");
780     sb.append("id:");
781     sb.append(this.id);
782     first = false;
783     if (!first) sb.append(", ");
784     sb.append("name:");
785     if (this.name == null) {
786       sb.append("null");
787     } else {
788       sb.append(this.name);
789     }
790     first = false;
791     if (!first) sb.append(", ");
792     sb.append("version:");
793     sb.append(this.version);
794     first = false;
795     if (!first) sb.append(", ");
796     sb.append("serverName:");
797     if (this.serverName == null) {
798       sb.append("null");
799     } else {
800       sb.append(this.serverName);
801     }
802     first = false;
803     if (!first) sb.append(", ");
804     sb.append("port:");
805     sb.append(this.port);
806     first = false;
807     sb.append(")");
808     return sb.toString();
809   }
810 
811   public void validate() throws org.apache.thrift.TException {
812     // check for required fields
813   }
814 
815   private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
816     try {
817       write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
818     } catch (org.apache.thrift.TException te) {
819       throw new java.io.IOException(te);
820     }
821   }
822 
823   private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
824     try {
825       // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
826       __isset_bit_vector = new BitSet(1);
827       read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
828     } catch (org.apache.thrift.TException te) {
829       throw new java.io.IOException(te);
830     }
831   }
832 
833   private static class TRegionInfoStandardSchemeFactory implements SchemeFactory {
834     public TRegionInfoStandardScheme getScheme() {
835       return new TRegionInfoStandardScheme();
836     }
837   }
838 
839   private static class TRegionInfoStandardScheme extends StandardScheme<TRegionInfo> {
840 
841     public void read(org.apache.thrift.protocol.TProtocol iprot, TRegionInfo struct) throws org.apache.thrift.TException {
842       org.apache.thrift.protocol.TField schemeField;
843       iprot.readStructBegin();
844       while (true)
845       {
846         schemeField = iprot.readFieldBegin();
847         if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
848           break;
849         }
850         switch (schemeField.id) {
851           case 1: // START_KEY
852             if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
853               struct.startKey = iprot.readBinary();
854               struct.setStartKeyIsSet(true);
855             } else { 
856               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
857             }
858             break;
859           case 2: // END_KEY
860             if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
861               struct.endKey = iprot.readBinary();
862               struct.setEndKeyIsSet(true);
863             } else { 
864               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
865             }
866             break;
867           case 3: // ID
868             if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
869               struct.id = iprot.readI64();
870               struct.setIdIsSet(true);
871             } else { 
872               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
873             }
874             break;
875           case 4: // NAME
876             if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
877               struct.name = iprot.readBinary();
878               struct.setNameIsSet(true);
879             } else { 
880               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
881             }
882             break;
883           case 5: // VERSION
884             if (schemeField.type == org.apache.thrift.protocol.TType.BYTE) {
885               struct.version = iprot.readByte();
886               struct.setVersionIsSet(true);
887             } else { 
888               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
889             }
890             break;
891           case 6: // SERVER_NAME
892             if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
893               struct.serverName = iprot.readBinary();
894               struct.setServerNameIsSet(true);
895             } else { 
896               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
897             }
898             break;
899           case 7: // PORT
900             if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
901               struct.port = iprot.readI32();
902               struct.setPortIsSet(true);
903             } else { 
904               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
905             }
906             break;
907           default:
908             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
909         }
910         iprot.readFieldEnd();
911       }
912       iprot.readStructEnd();
913 
914       // check for required fields of primitive type, which can't be checked in the validate method
915       struct.validate();
916     }
917 
918     public void write(org.apache.thrift.protocol.TProtocol oprot, TRegionInfo struct) throws org.apache.thrift.TException {
919       struct.validate();
920 
921       oprot.writeStructBegin(STRUCT_DESC);
922       if (struct.startKey != null) {
923         oprot.writeFieldBegin(START_KEY_FIELD_DESC);
924         oprot.writeBinary(struct.startKey);
925         oprot.writeFieldEnd();
926       }
927       if (struct.endKey != null) {
928         oprot.writeFieldBegin(END_KEY_FIELD_DESC);
929         oprot.writeBinary(struct.endKey);
930         oprot.writeFieldEnd();
931       }
932       oprot.writeFieldBegin(ID_FIELD_DESC);
933       oprot.writeI64(struct.id);
934       oprot.writeFieldEnd();
935       if (struct.name != null) {
936         oprot.writeFieldBegin(NAME_FIELD_DESC);
937         oprot.writeBinary(struct.name);
938         oprot.writeFieldEnd();
939       }
940       oprot.writeFieldBegin(VERSION_FIELD_DESC);
941       oprot.writeByte(struct.version);
942       oprot.writeFieldEnd();
943       if (struct.serverName != null) {
944         oprot.writeFieldBegin(SERVER_NAME_FIELD_DESC);
945         oprot.writeBinary(struct.serverName);
946         oprot.writeFieldEnd();
947       }
948       oprot.writeFieldBegin(PORT_FIELD_DESC);
949       oprot.writeI32(struct.port);
950       oprot.writeFieldEnd();
951       oprot.writeFieldStop();
952       oprot.writeStructEnd();
953     }
954 
955   }
956 
957   private static class TRegionInfoTupleSchemeFactory implements SchemeFactory {
958     public TRegionInfoTupleScheme getScheme() {
959       return new TRegionInfoTupleScheme();
960     }
961   }
962 
963   private static class TRegionInfoTupleScheme extends TupleScheme<TRegionInfo> {
964 
965     @Override
966     public void write(org.apache.thrift.protocol.TProtocol prot, TRegionInfo struct) throws org.apache.thrift.TException {
967       TTupleProtocol oprot = (TTupleProtocol) prot;
968       BitSet optionals = new BitSet();
969       if (struct.isSetStartKey()) {
970         optionals.set(0);
971       }
972       if (struct.isSetEndKey()) {
973         optionals.set(1);
974       }
975       if (struct.isSetId()) {
976         optionals.set(2);
977       }
978       if (struct.isSetName()) {
979         optionals.set(3);
980       }
981       if (struct.isSetVersion()) {
982         optionals.set(4);
983       }
984       if (struct.isSetServerName()) {
985         optionals.set(5);
986       }
987       if (struct.isSetPort()) {
988         optionals.set(6);
989       }
990       oprot.writeBitSet(optionals, 7);
991       if (struct.isSetStartKey()) {
992         oprot.writeBinary(struct.startKey);
993       }
994       if (struct.isSetEndKey()) {
995         oprot.writeBinary(struct.endKey);
996       }
997       if (struct.isSetId()) {
998         oprot.writeI64(struct.id);
999       }
1000       if (struct.isSetName()) {
1001         oprot.writeBinary(struct.name);
1002       }
1003       if (struct.isSetVersion()) {
1004         oprot.writeByte(struct.version);
1005       }
1006       if (struct.isSetServerName()) {
1007         oprot.writeBinary(struct.serverName);
1008       }
1009       if (struct.isSetPort()) {
1010         oprot.writeI32(struct.port);
1011       }
1012     }
1013 
1014     @Override
1015     public void read(org.apache.thrift.protocol.TProtocol prot, TRegionInfo struct) throws org.apache.thrift.TException {
1016       TTupleProtocol iprot = (TTupleProtocol) prot;
1017       BitSet incoming = iprot.readBitSet(7);
1018       if (incoming.get(0)) {
1019         struct.startKey = iprot.readBinary();
1020         struct.setStartKeyIsSet(true);
1021       }
1022       if (incoming.get(1)) {
1023         struct.endKey = iprot.readBinary();
1024         struct.setEndKeyIsSet(true);
1025       }
1026       if (incoming.get(2)) {
1027         struct.id = iprot.readI64();
1028         struct.setIdIsSet(true);
1029       }
1030       if (incoming.get(3)) {
1031         struct.name = iprot.readBinary();
1032         struct.setNameIsSet(true);
1033       }
1034       if (incoming.get(4)) {
1035         struct.version = iprot.readByte();
1036         struct.setVersionIsSet(true);
1037       }
1038       if (incoming.get(5)) {
1039         struct.serverName = iprot.readBinary();
1040         struct.setServerNameIsSet(true);
1041       }
1042       if (incoming.get(6)) {
1043         struct.port = iprot.readI32();
1044         struct.setPortIsSet(true);
1045       }
1046     }
1047   }
1048 
1049 }
1050