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