View Javadoc

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