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