View Javadoc

1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.hadoop.hbase.thrift.generated;
19  
20  import org.apache.commons.lang.builder.HashCodeBuilder;
21  import java.util.List;
22  import java.util.ArrayList;
23  import java.util.Map;
24  import java.util.HashMap;
25  import java.util.EnumMap;
26  import java.util.Set;
27  import java.util.HashSet;
28  import java.util.EnumSet;
29  import java.util.Collections;
30  import java.util.BitSet;
31  import java.util.Arrays;
32  import org.slf4j.Logger;
33  import org.slf4j.LoggerFactory;
34  
35  import org.apache.thrift.*;
36  import org.apache.thrift.meta_data.*;
37  import org.apache.thrift.protocol.*;
38  
39  /**
40   * An HColumnDescriptor contains information about a column family
41   * such as the number of versions, compression settings, etc. It is
42   * used as input when creating a table or adding a column.
43   */
44  public class ColumnDescriptor implements TBase<ColumnDescriptor._Fields>, java.io.Serializable, Cloneable, Comparable<ColumnDescriptor> {
45    private static final TStruct STRUCT_DESC = new TStruct("ColumnDescriptor");
46  
47    private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)1);
48    private static final TField MAX_VERSIONS_FIELD_DESC = new TField("maxVersions", TType.I32, (short)2);
49    private static final TField COMPRESSION_FIELD_DESC = new TField("compression", TType.STRING, (short)3);
50    private static final TField IN_MEMORY_FIELD_DESC = new TField("inMemory", TType.BOOL, (short)4);
51    private static final TField BLOOM_FILTER_TYPE_FIELD_DESC = new TField("bloomFilterType", TType.STRING, (short)5);
52    private static final TField BLOOM_FILTER_VECTOR_SIZE_FIELD_DESC = new TField("bloomFilterVectorSize", TType.I32, (short)6);
53    private static final TField BLOOM_FILTER_NB_HASHES_FIELD_DESC = new TField("bloomFilterNbHashes", TType.I32, (short)7);
54    private static final TField BLOCK_CACHE_ENABLED_FIELD_DESC = new TField("blockCacheEnabled", TType.BOOL, (short)8);
55    private static final TField TIME_TO_LIVE_FIELD_DESC = new TField("timeToLive", TType.I32, (short)9);
56  
57    public byte[] name;
58    public int maxVersions;
59    public String compression;
60    public boolean inMemory;
61    public String bloomFilterType;
62    public int bloomFilterVectorSize;
63    public int bloomFilterNbHashes;
64    public boolean blockCacheEnabled;
65    public int timeToLive;
66  
67    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
68    public enum _Fields implements TFieldIdEnum {
69      NAME((short)1, "name"),
70      MAX_VERSIONS((short)2, "maxVersions"),
71      COMPRESSION((short)3, "compression"),
72      IN_MEMORY((short)4, "inMemory"),
73      BLOOM_FILTER_TYPE((short)5, "bloomFilterType"),
74      BLOOM_FILTER_VECTOR_SIZE((short)6, "bloomFilterVectorSize"),
75      BLOOM_FILTER_NB_HASHES((short)7, "bloomFilterNbHashes"),
76      BLOCK_CACHE_ENABLED((short)8, "blockCacheEnabled"),
77      TIME_TO_LIVE((short)9, "timeToLive");
78  
79      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
80      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
81  
82      static {
83        for (_Fields field : EnumSet.allOf(_Fields.class)) {
84          byId.put((int)field._thriftId, field);
85          byName.put(field.getFieldName(), field);
86        }
87      }
88  
89      /**
90       * Find the _Fields constant that matches fieldId, or null if its not found.
91       */
92      public static _Fields findByThriftId(int fieldId) {
93        return byId.get(fieldId);
94      }
95  
96      /**
97       * Find the _Fields constant that matches fieldId, throwing an exception
98       * if it is not found.
99       */
100     public static _Fields findByThriftIdOrThrow(int fieldId) {
101       _Fields fields = findByThriftId(fieldId);
102       if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
103       return fields;
104     }
105 
106     /**
107      * Find the _Fields constant that matches name, or null if its not found.
108      */
109     public static _Fields findByName(String name) {
110       return byName.get(name);
111     }
112 
113     private final short _thriftId;
114     private final String _fieldName;
115 
116     _Fields(short thriftId, String fieldName) {
117       _thriftId = thriftId;
118       _fieldName = fieldName;
119     }
120 
121     public short getThriftFieldId() {
122       return _thriftId;
123     }
124 
125     public String getFieldName() {
126       return _fieldName;
127     }
128   }
129 
130   // isset id assignments
131   private static final int __MAXVERSIONS_ISSET_ID = 0;
132   private static final int __INMEMORY_ISSET_ID = 1;
133   private static final int __BLOOMFILTERVECTORSIZE_ISSET_ID = 2;
134   private static final int __BLOOMFILTERNBHASHES_ISSET_ID = 3;
135   private static final int __BLOCKCACHEENABLED_ISSET_ID = 4;
136   private static final int __TIMETOLIVE_ISSET_ID = 5;
137   private BitSet __isset_bit_vector = new BitSet(6);
138 
139   public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
140     put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT,
141         new FieldValueMetaData(TType.STRING)));
142     put(_Fields.MAX_VERSIONS, new FieldMetaData("maxVersions", TFieldRequirementType.DEFAULT,
143         new FieldValueMetaData(TType.I32)));
144     put(_Fields.COMPRESSION, new FieldMetaData("compression", TFieldRequirementType.DEFAULT,
145         new FieldValueMetaData(TType.STRING)));
146     put(_Fields.IN_MEMORY, new FieldMetaData("inMemory", TFieldRequirementType.DEFAULT,
147         new FieldValueMetaData(TType.BOOL)));
148     put(_Fields.BLOOM_FILTER_TYPE, new FieldMetaData("bloomFilterType", TFieldRequirementType.DEFAULT,
149         new FieldValueMetaData(TType.STRING)));
150     put(_Fields.BLOOM_FILTER_VECTOR_SIZE, new FieldMetaData("bloomFilterVectorSize", TFieldRequirementType.DEFAULT,
151         new FieldValueMetaData(TType.I32)));
152     put(_Fields.BLOOM_FILTER_NB_HASHES, new FieldMetaData("bloomFilterNbHashes", TFieldRequirementType.DEFAULT,
153         new FieldValueMetaData(TType.I32)));
154     put(_Fields.BLOCK_CACHE_ENABLED, new FieldMetaData("blockCacheEnabled", TFieldRequirementType.DEFAULT,
155         new FieldValueMetaData(TType.BOOL)));
156     put(_Fields.TIME_TO_LIVE, new FieldMetaData("timeToLive", TFieldRequirementType.DEFAULT,
157         new FieldValueMetaData(TType.I32)));
158   }});
159 
160   static {
161     FieldMetaData.addStructMetaDataMap(ColumnDescriptor.class, metaDataMap);
162   }
163 
164   public ColumnDescriptor() {
165     this.maxVersions = 3;
166 
167     this.compression = "NONE";
168 
169     this.inMemory = false;
170 
171     this.bloomFilterType = "NONE";
172 
173     this.bloomFilterVectorSize = 0;
174 
175     this.bloomFilterNbHashes = 0;
176 
177     this.blockCacheEnabled = false;
178 
179     this.timeToLive = -1;
180 
181   }
182 
183   public ColumnDescriptor(
184     byte[] name,
185     int maxVersions,
186     String compression,
187     boolean inMemory,
188     String bloomFilterType,
189     int bloomFilterVectorSize,
190     int bloomFilterNbHashes,
191     boolean blockCacheEnabled,
192     int timeToLive)
193   {
194     this();
195     this.name = name;
196     this.maxVersions = maxVersions;
197     setMaxVersionsIsSet(true);
198     this.compression = compression;
199     this.inMemory = inMemory;
200     setInMemoryIsSet(true);
201     this.bloomFilterType = bloomFilterType;
202     this.bloomFilterVectorSize = bloomFilterVectorSize;
203     setBloomFilterVectorSizeIsSet(true);
204     this.bloomFilterNbHashes = bloomFilterNbHashes;
205     setBloomFilterNbHashesIsSet(true);
206     this.blockCacheEnabled = blockCacheEnabled;
207     setBlockCacheEnabledIsSet(true);
208     this.timeToLive = timeToLive;
209     setTimeToLiveIsSet(true);
210   }
211 
212   /**
213    * Performs a deep copy on <i>other</i>.
214    */
215   public ColumnDescriptor(ColumnDescriptor other) {
216     __isset_bit_vector.clear();
217     __isset_bit_vector.or(other.__isset_bit_vector);
218     if (other.isSetName()) {
219       this.name = other.name;
220     }
221     this.maxVersions = other.maxVersions;
222     if (other.isSetCompression()) {
223       this.compression = other.compression;
224     }
225     this.inMemory = other.inMemory;
226     if (other.isSetBloomFilterType()) {
227       this.bloomFilterType = other.bloomFilterType;
228     }
229     this.bloomFilterVectorSize = other.bloomFilterVectorSize;
230     this.bloomFilterNbHashes = other.bloomFilterNbHashes;
231     this.blockCacheEnabled = other.blockCacheEnabled;
232     this.timeToLive = other.timeToLive;
233   }
234 
235   public ColumnDescriptor deepCopy() {
236     return new ColumnDescriptor(this);
237   }
238 
239   @Deprecated
240   public ColumnDescriptor clone() {
241     return new ColumnDescriptor(this);
242   }
243 
244   public byte[] getName() {
245     return this.name;
246   }
247 
248   public ColumnDescriptor setName(byte[] name) {
249     this.name = name;
250     return this;
251   }
252 
253   public void unsetName() {
254     this.name = null;
255   }
256 
257   /** Returns true if field name is set (has been asigned a value) and false otherwise */
258   public boolean isSetName() {
259     return this.name != null;
260   }
261 
262   public void setNameIsSet(boolean value) {
263     if (!value) {
264       this.name = null;
265     }
266   }
267 
268   public int getMaxVersions() {
269     return this.maxVersions;
270   }
271 
272   public ColumnDescriptor setMaxVersions(int maxVersions) {
273     this.maxVersions = maxVersions;
274     setMaxVersionsIsSet(true);
275     return this;
276   }
277 
278   public void unsetMaxVersions() {
279     __isset_bit_vector.clear(__MAXVERSIONS_ISSET_ID);
280   }
281 
282   /** Returns true if field maxVersions is set (has been asigned a value) and false otherwise */
283   public boolean isSetMaxVersions() {
284     return __isset_bit_vector.get(__MAXVERSIONS_ISSET_ID);
285   }
286 
287   public void setMaxVersionsIsSet(boolean value) {
288     __isset_bit_vector.set(__MAXVERSIONS_ISSET_ID, value);
289   }
290 
291   public String getCompression() {
292     return this.compression;
293   }
294 
295   public ColumnDescriptor setCompression(String compression) {
296     this.compression = compression;
297     return this;
298   }
299 
300   public void unsetCompression() {
301     this.compression = null;
302   }
303 
304   /** Returns true if field compression is set (has been asigned a value) and false otherwise */
305   public boolean isSetCompression() {
306     return this.compression != null;
307   }
308 
309   public void setCompressionIsSet(boolean value) {
310     if (!value) {
311       this.compression = null;
312     }
313   }
314 
315   public boolean isInMemory() {
316     return this.inMemory;
317   }
318 
319   public ColumnDescriptor setInMemory(boolean inMemory) {
320     this.inMemory = inMemory;
321     setInMemoryIsSet(true);
322     return this;
323   }
324 
325   public void unsetInMemory() {
326     __isset_bit_vector.clear(__INMEMORY_ISSET_ID);
327   }
328 
329   /** Returns true if field inMemory is set (has been asigned a value) and false otherwise */
330   public boolean isSetInMemory() {
331     return __isset_bit_vector.get(__INMEMORY_ISSET_ID);
332   }
333 
334   public void setInMemoryIsSet(boolean value) {
335     __isset_bit_vector.set(__INMEMORY_ISSET_ID, value);
336   }
337 
338   public String getBloomFilterType() {
339     return this.bloomFilterType;
340   }
341 
342   public ColumnDescriptor setBloomFilterType(String bloomFilterType) {
343     this.bloomFilterType = bloomFilterType;
344     return this;
345   }
346 
347   public void unsetBloomFilterType() {
348     this.bloomFilterType = null;
349   }
350 
351   /** Returns true if field bloomFilterType is set (has been asigned a value) and false otherwise */
352   public boolean isSetBloomFilterType() {
353     return this.bloomFilterType != null;
354   }
355 
356   public void setBloomFilterTypeIsSet(boolean value) {
357     if (!value) {
358       this.bloomFilterType = null;
359     }
360   }
361 
362   public int getBloomFilterVectorSize() {
363     return this.bloomFilterVectorSize;
364   }
365 
366   public ColumnDescriptor setBloomFilterVectorSize(int bloomFilterVectorSize) {
367     this.bloomFilterVectorSize = bloomFilterVectorSize;
368     setBloomFilterVectorSizeIsSet(true);
369     return this;
370   }
371 
372   public void unsetBloomFilterVectorSize() {
373     __isset_bit_vector.clear(__BLOOMFILTERVECTORSIZE_ISSET_ID);
374   }
375 
376   /** Returns true if field bloomFilterVectorSize is set (has been asigned a value) and false otherwise */
377   public boolean isSetBloomFilterVectorSize() {
378     return __isset_bit_vector.get(__BLOOMFILTERVECTORSIZE_ISSET_ID);
379   }
380 
381   public void setBloomFilterVectorSizeIsSet(boolean value) {
382     __isset_bit_vector.set(__BLOOMFILTERVECTORSIZE_ISSET_ID, value);
383   }
384 
385   public int getBloomFilterNbHashes() {
386     return this.bloomFilterNbHashes;
387   }
388 
389   public ColumnDescriptor setBloomFilterNbHashes(int bloomFilterNbHashes) {
390     this.bloomFilterNbHashes = bloomFilterNbHashes;
391     setBloomFilterNbHashesIsSet(true);
392     return this;
393   }
394 
395   public void unsetBloomFilterNbHashes() {
396     __isset_bit_vector.clear(__BLOOMFILTERNBHASHES_ISSET_ID);
397   }
398 
399   /** Returns true if field bloomFilterNbHashes is set (has been asigned a value) and false otherwise */
400   public boolean isSetBloomFilterNbHashes() {
401     return __isset_bit_vector.get(__BLOOMFILTERNBHASHES_ISSET_ID);
402   }
403 
404   public void setBloomFilterNbHashesIsSet(boolean value) {
405     __isset_bit_vector.set(__BLOOMFILTERNBHASHES_ISSET_ID, value);
406   }
407 
408   public boolean isBlockCacheEnabled() {
409     return this.blockCacheEnabled;
410   }
411 
412   public ColumnDescriptor setBlockCacheEnabled(boolean blockCacheEnabled) {
413     this.blockCacheEnabled = blockCacheEnabled;
414     setBlockCacheEnabledIsSet(true);
415     return this;
416   }
417 
418   public void unsetBlockCacheEnabled() {
419     __isset_bit_vector.clear(__BLOCKCACHEENABLED_ISSET_ID);
420   }
421 
422   /** Returns true if field blockCacheEnabled is set (has been asigned a value) and false otherwise */
423   public boolean isSetBlockCacheEnabled() {
424     return __isset_bit_vector.get(__BLOCKCACHEENABLED_ISSET_ID);
425   }
426 
427   public void setBlockCacheEnabledIsSet(boolean value) {
428     __isset_bit_vector.set(__BLOCKCACHEENABLED_ISSET_ID, value);
429   }
430 
431   public int getTimeToLive() {
432     return this.timeToLive;
433   }
434 
435   public ColumnDescriptor setTimeToLive(int timeToLive) {
436     this.timeToLive = timeToLive;
437     setTimeToLiveIsSet(true);
438     return this;
439   }
440 
441   public void unsetTimeToLive() {
442     __isset_bit_vector.clear(__TIMETOLIVE_ISSET_ID);
443   }
444 
445   /** Returns true if field timeToLive is set (has been asigned a value) and false otherwise */
446   public boolean isSetTimeToLive() {
447     return __isset_bit_vector.get(__TIMETOLIVE_ISSET_ID);
448   }
449 
450   public void setTimeToLiveIsSet(boolean value) {
451     __isset_bit_vector.set(__TIMETOLIVE_ISSET_ID, value);
452   }
453 
454   public void setFieldValue(_Fields field, Object value) {
455     switch (field) {
456     case NAME:
457       if (value == null) {
458         unsetName();
459       } else {
460         setName((byte[])value);
461       }
462       break;
463 
464     case MAX_VERSIONS:
465       if (value == null) {
466         unsetMaxVersions();
467       } else {
468         setMaxVersions((Integer)value);
469       }
470       break;
471 
472     case COMPRESSION:
473       if (value == null) {
474         unsetCompression();
475       } else {
476         setCompression((String)value);
477       }
478       break;
479 
480     case IN_MEMORY:
481       if (value == null) {
482         unsetInMemory();
483       } else {
484         setInMemory((Boolean)value);
485       }
486       break;
487 
488     case BLOOM_FILTER_TYPE:
489       if (value == null) {
490         unsetBloomFilterType();
491       } else {
492         setBloomFilterType((String)value);
493       }
494       break;
495 
496     case BLOOM_FILTER_VECTOR_SIZE:
497       if (value == null) {
498         unsetBloomFilterVectorSize();
499       } else {
500         setBloomFilterVectorSize((Integer)value);
501       }
502       break;
503 
504     case BLOOM_FILTER_NB_HASHES:
505       if (value == null) {
506         unsetBloomFilterNbHashes();
507       } else {
508         setBloomFilterNbHashes((Integer)value);
509       }
510       break;
511 
512     case BLOCK_CACHE_ENABLED:
513       if (value == null) {
514         unsetBlockCacheEnabled();
515       } else {
516         setBlockCacheEnabled((Boolean)value);
517       }
518       break;
519 
520     case TIME_TO_LIVE:
521       if (value == null) {
522         unsetTimeToLive();
523       } else {
524         setTimeToLive((Integer)value);
525       }
526       break;
527 
528     }
529   }
530 
531   public void setFieldValue(int fieldID, Object value) {
532     setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
533   }
534 
535   public Object getFieldValue(_Fields field) {
536     switch (field) {
537     case NAME:
538       return getName();
539 
540     case MAX_VERSIONS:
541       return new Integer(getMaxVersions());
542 
543     case COMPRESSION:
544       return getCompression();
545 
546     case IN_MEMORY:
547       return new Boolean(isInMemory());
548 
549     case BLOOM_FILTER_TYPE:
550       return getBloomFilterType();
551 
552     case BLOOM_FILTER_VECTOR_SIZE:
553       return new Integer(getBloomFilterVectorSize());
554 
555     case BLOOM_FILTER_NB_HASHES:
556       return new Integer(getBloomFilterNbHashes());
557 
558     case BLOCK_CACHE_ENABLED:
559       return new Boolean(isBlockCacheEnabled());
560 
561     case TIME_TO_LIVE:
562       return new Integer(getTimeToLive());
563 
564     }
565     throw new IllegalStateException();
566   }
567 
568   public Object getFieldValue(int fieldId) {
569     return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
570   }
571 
572   /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
573   public boolean isSet(_Fields field) {
574     switch (field) {
575     case NAME:
576       return isSetName();
577     case MAX_VERSIONS:
578       return isSetMaxVersions();
579     case COMPRESSION:
580       return isSetCompression();
581     case IN_MEMORY:
582       return isSetInMemory();
583     case BLOOM_FILTER_TYPE:
584       return isSetBloomFilterType();
585     case BLOOM_FILTER_VECTOR_SIZE:
586       return isSetBloomFilterVectorSize();
587     case BLOOM_FILTER_NB_HASHES:
588       return isSetBloomFilterNbHashes();
589     case BLOCK_CACHE_ENABLED:
590       return isSetBlockCacheEnabled();
591     case TIME_TO_LIVE:
592       return isSetTimeToLive();
593     }
594     throw new IllegalStateException();
595   }
596 
597   public boolean isSet(int fieldID) {
598     return isSet(_Fields.findByThriftIdOrThrow(fieldID));
599   }
600 
601   @Override
602   public boolean equals(Object that) {
603     if (that == null)
604       return false;
605     if (that instanceof ColumnDescriptor)
606       return this.equals((ColumnDescriptor)that);
607     return false;
608   }
609 
610   public boolean equals(ColumnDescriptor that) {
611     if (that == null)
612       return false;
613 
614     boolean this_present_name = true && this.isSetName();
615     boolean that_present_name = true && that.isSetName();
616     if (this_present_name || that_present_name) {
617       if (!(this_present_name && that_present_name))
618         return false;
619       if (!java.util.Arrays.equals(this.name, that.name))
620         return false;
621     }
622 
623     boolean this_present_maxVersions = true;
624     boolean that_present_maxVersions = true;
625     if (this_present_maxVersions || that_present_maxVersions) {
626       if (!(this_present_maxVersions && that_present_maxVersions))
627         return false;
628       if (this.maxVersions != that.maxVersions)
629         return false;
630     }
631 
632     boolean this_present_compression = true && this.isSetCompression();
633     boolean that_present_compression = true && that.isSetCompression();
634     if (this_present_compression || that_present_compression) {
635       if (!(this_present_compression && that_present_compression))
636         return false;
637       if (!this.compression.equals(that.compression))
638         return false;
639     }
640 
641     boolean this_present_inMemory = true;
642     boolean that_present_inMemory = true;
643     if (this_present_inMemory || that_present_inMemory) {
644       if (!(this_present_inMemory && that_present_inMemory))
645         return false;
646       if (this.inMemory != that.inMemory)
647         return false;
648     }
649 
650     boolean this_present_bloomFilterType = true && this.isSetBloomFilterType();
651     boolean that_present_bloomFilterType = true && that.isSetBloomFilterType();
652     if (this_present_bloomFilterType || that_present_bloomFilterType) {
653       if (!(this_present_bloomFilterType && that_present_bloomFilterType))
654         return false;
655       if (!this.bloomFilterType.equals(that.bloomFilterType))
656         return false;
657     }
658 
659     boolean this_present_bloomFilterVectorSize = true;
660     boolean that_present_bloomFilterVectorSize = true;
661     if (this_present_bloomFilterVectorSize || that_present_bloomFilterVectorSize) {
662       if (!(this_present_bloomFilterVectorSize && that_present_bloomFilterVectorSize))
663         return false;
664       if (this.bloomFilterVectorSize != that.bloomFilterVectorSize)
665         return false;
666     }
667 
668     boolean this_present_bloomFilterNbHashes = true;
669     boolean that_present_bloomFilterNbHashes = true;
670     if (this_present_bloomFilterNbHashes || that_present_bloomFilterNbHashes) {
671       if (!(this_present_bloomFilterNbHashes && that_present_bloomFilterNbHashes))
672         return false;
673       if (this.bloomFilterNbHashes != that.bloomFilterNbHashes)
674         return false;
675     }
676 
677     boolean this_present_blockCacheEnabled = true;
678     boolean that_present_blockCacheEnabled = true;
679     if (this_present_blockCacheEnabled || that_present_blockCacheEnabled) {
680       if (!(this_present_blockCacheEnabled && that_present_blockCacheEnabled))
681         return false;
682       if (this.blockCacheEnabled != that.blockCacheEnabled)
683         return false;
684     }
685 
686     boolean this_present_timeToLive = true;
687     boolean that_present_timeToLive = true;
688     if (this_present_timeToLive || that_present_timeToLive) {
689       if (!(this_present_timeToLive && that_present_timeToLive))
690         return false;
691       if (this.timeToLive != that.timeToLive)
692         return false;
693     }
694 
695     return true;
696   }
697 
698   @Override
699   public int hashCode() {
700     HashCodeBuilder builder = new HashCodeBuilder();
701 
702     boolean present_name = true && (isSetName());
703     builder.append(present_name);
704     if (present_name)
705       builder.append(name);
706 
707     boolean present_maxVersions = true;
708     builder.append(present_maxVersions);
709     if (present_maxVersions)
710       builder.append(maxVersions);
711 
712     boolean present_compression = true && (isSetCompression());
713     builder.append(present_compression);
714     if (present_compression)
715       builder.append(compression);
716 
717     boolean present_inMemory = true;
718     builder.append(present_inMemory);
719     if (present_inMemory)
720       builder.append(inMemory);
721 
722     boolean present_bloomFilterType = true && (isSetBloomFilterType());
723     builder.append(present_bloomFilterType);
724     if (present_bloomFilterType)
725       builder.append(bloomFilterType);
726 
727     boolean present_bloomFilterVectorSize = true;
728     builder.append(present_bloomFilterVectorSize);
729     if (present_bloomFilterVectorSize)
730       builder.append(bloomFilterVectorSize);
731 
732     boolean present_bloomFilterNbHashes = true;
733     builder.append(present_bloomFilterNbHashes);
734     if (present_bloomFilterNbHashes)
735       builder.append(bloomFilterNbHashes);
736 
737     boolean present_blockCacheEnabled = true;
738     builder.append(present_blockCacheEnabled);
739     if (present_blockCacheEnabled)
740       builder.append(blockCacheEnabled);
741 
742     boolean present_timeToLive = true;
743     builder.append(present_timeToLive);
744     if (present_timeToLive)
745       builder.append(timeToLive);
746 
747     return builder.toHashCode();
748   }
749 
750   public int compareTo(ColumnDescriptor other) {
751     if (!getClass().equals(other.getClass())) {
752       return getClass().getName().compareTo(other.getClass().getName());
753     }
754 
755     int lastComparison = 0;
756     ColumnDescriptor typedOther = (ColumnDescriptor)other;
757 
758     lastComparison = Boolean.valueOf(isSetName()).compareTo(isSetName());
759     if (lastComparison != 0) {
760       return lastComparison;
761     }
762     lastComparison = TBaseHelper.compareTo(name, typedOther.name);
763     if (lastComparison != 0) {
764       return lastComparison;
765     }
766     lastComparison = Boolean.valueOf(isSetMaxVersions()).compareTo(isSetMaxVersions());
767     if (lastComparison != 0) {
768       return lastComparison;
769     }
770     lastComparison = TBaseHelper.compareTo(maxVersions, typedOther.maxVersions);
771     if (lastComparison != 0) {
772       return lastComparison;
773     }
774     lastComparison = Boolean.valueOf(isSetCompression()).compareTo(isSetCompression());
775     if (lastComparison != 0) {
776       return lastComparison;
777     }
778     lastComparison = TBaseHelper.compareTo(compression, typedOther.compression);
779     if (lastComparison != 0) {
780       return lastComparison;
781     }
782     lastComparison = Boolean.valueOf(isSetInMemory()).compareTo(isSetInMemory());
783     if (lastComparison != 0) {
784       return lastComparison;
785     }
786     lastComparison = TBaseHelper.compareTo(inMemory, typedOther.inMemory);
787     if (lastComparison != 0) {
788       return lastComparison;
789     }
790     lastComparison = Boolean.valueOf(isSetBloomFilterType()).compareTo(isSetBloomFilterType());
791     if (lastComparison != 0) {
792       return lastComparison;
793     }
794     lastComparison = TBaseHelper.compareTo(bloomFilterType, typedOther.bloomFilterType);
795     if (lastComparison != 0) {
796       return lastComparison;
797     }
798     lastComparison = Boolean.valueOf(isSetBloomFilterVectorSize()).compareTo(isSetBloomFilterVectorSize());
799     if (lastComparison != 0) {
800       return lastComparison;
801     }
802     lastComparison = TBaseHelper.compareTo(bloomFilterVectorSize, typedOther.bloomFilterVectorSize);
803     if (lastComparison != 0) {
804       return lastComparison;
805     }
806     lastComparison = Boolean.valueOf(isSetBloomFilterNbHashes()).compareTo(isSetBloomFilterNbHashes());
807     if (lastComparison != 0) {
808       return lastComparison;
809     }
810     lastComparison = TBaseHelper.compareTo(bloomFilterNbHashes, typedOther.bloomFilterNbHashes);
811     if (lastComparison != 0) {
812       return lastComparison;
813     }
814     lastComparison = Boolean.valueOf(isSetBlockCacheEnabled()).compareTo(isSetBlockCacheEnabled());
815     if (lastComparison != 0) {
816       return lastComparison;
817     }
818     lastComparison = TBaseHelper.compareTo(blockCacheEnabled, typedOther.blockCacheEnabled);
819     if (lastComparison != 0) {
820       return lastComparison;
821     }
822     lastComparison = Boolean.valueOf(isSetTimeToLive()).compareTo(isSetTimeToLive());
823     if (lastComparison != 0) {
824       return lastComparison;
825     }
826     lastComparison = TBaseHelper.compareTo(timeToLive, typedOther.timeToLive);
827     if (lastComparison != 0) {
828       return lastComparison;
829     }
830     return 0;
831   }
832 
833   public void read(TProtocol iprot) throws TException {
834     TField field;
835     iprot.readStructBegin();
836     while (true)
837     {
838       field = iprot.readFieldBegin();
839       if (field.type == TType.STOP) {
840         break;
841       }
842       _Fields fieldId = _Fields.findByThriftId(field.id);
843       if (fieldId == null) {
844         TProtocolUtil.skip(iprot, field.type);
845       } else {
846         switch (fieldId) {
847           case NAME:
848             if (field.type == TType.STRING) {
849               this.name = iprot.readBinary();
850             } else {
851               TProtocolUtil.skip(iprot, field.type);
852             }
853             break;
854           case MAX_VERSIONS:
855             if (field.type == TType.I32) {
856               this.maxVersions = iprot.readI32();
857               setMaxVersionsIsSet(true);
858             } else {
859               TProtocolUtil.skip(iprot, field.type);
860             }
861             break;
862           case COMPRESSION:
863             if (field.type == TType.STRING) {
864               this.compression = iprot.readString();
865             } else {
866               TProtocolUtil.skip(iprot, field.type);
867             }
868             break;
869           case IN_MEMORY:
870             if (field.type == TType.BOOL) {
871               this.inMemory = iprot.readBool();
872               setInMemoryIsSet(true);
873             } else {
874               TProtocolUtil.skip(iprot, field.type);
875             }
876             break;
877           case BLOOM_FILTER_TYPE:
878             if (field.type == TType.STRING) {
879               this.bloomFilterType = iprot.readString();
880             } else {
881               TProtocolUtil.skip(iprot, field.type);
882             }
883             break;
884           case BLOOM_FILTER_VECTOR_SIZE:
885             if (field.type == TType.I32) {
886               this.bloomFilterVectorSize = iprot.readI32();
887               setBloomFilterVectorSizeIsSet(true);
888             } else {
889               TProtocolUtil.skip(iprot, field.type);
890             }
891             break;
892           case BLOOM_FILTER_NB_HASHES:
893             if (field.type == TType.I32) {
894               this.bloomFilterNbHashes = iprot.readI32();
895               setBloomFilterNbHashesIsSet(true);
896             } else {
897               TProtocolUtil.skip(iprot, field.type);
898             }
899             break;
900           case BLOCK_CACHE_ENABLED:
901             if (field.type == TType.BOOL) {
902               this.blockCacheEnabled = iprot.readBool();
903               setBlockCacheEnabledIsSet(true);
904             } else {
905               TProtocolUtil.skip(iprot, field.type);
906             }
907             break;
908           case TIME_TO_LIVE:
909             if (field.type == TType.I32) {
910               this.timeToLive = iprot.readI32();
911               setTimeToLiveIsSet(true);
912             } else {
913               TProtocolUtil.skip(iprot, field.type);
914             }
915             break;
916         }
917         iprot.readFieldEnd();
918       }
919     }
920     iprot.readStructEnd();
921 
922     // check for required fields of primitive type, which can't be checked in the validate method
923     validate();
924   }
925 
926   public void write(TProtocol oprot) throws TException {
927     validate();
928 
929     oprot.writeStructBegin(STRUCT_DESC);
930     if (this.name != null) {
931       oprot.writeFieldBegin(NAME_FIELD_DESC);
932       oprot.writeBinary(this.name);
933       oprot.writeFieldEnd();
934     }
935     oprot.writeFieldBegin(MAX_VERSIONS_FIELD_DESC);
936     oprot.writeI32(this.maxVersions);
937     oprot.writeFieldEnd();
938     if (this.compression != null) {
939       oprot.writeFieldBegin(COMPRESSION_FIELD_DESC);
940       oprot.writeString(this.compression);
941       oprot.writeFieldEnd();
942     }
943     oprot.writeFieldBegin(IN_MEMORY_FIELD_DESC);
944     oprot.writeBool(this.inMemory);
945     oprot.writeFieldEnd();
946     if (this.bloomFilterType != null) {
947       oprot.writeFieldBegin(BLOOM_FILTER_TYPE_FIELD_DESC);
948       oprot.writeString(this.bloomFilterType);
949       oprot.writeFieldEnd();
950     }
951     oprot.writeFieldBegin(BLOOM_FILTER_VECTOR_SIZE_FIELD_DESC);
952     oprot.writeI32(this.bloomFilterVectorSize);
953     oprot.writeFieldEnd();
954     oprot.writeFieldBegin(BLOOM_FILTER_NB_HASHES_FIELD_DESC);
955     oprot.writeI32(this.bloomFilterNbHashes);
956     oprot.writeFieldEnd();
957     oprot.writeFieldBegin(BLOCK_CACHE_ENABLED_FIELD_DESC);
958     oprot.writeBool(this.blockCacheEnabled);
959     oprot.writeFieldEnd();
960     oprot.writeFieldBegin(TIME_TO_LIVE_FIELD_DESC);
961     oprot.writeI32(this.timeToLive);
962     oprot.writeFieldEnd();
963     oprot.writeFieldStop();
964     oprot.writeStructEnd();
965   }
966 
967   @Override
968   public String toString() {
969     StringBuilder sb = new StringBuilder("ColumnDescriptor(");
970     boolean first = true;
971 
972     sb.append("name:");
973     if (this.name == null) {
974       sb.append("null");
975     } else {
976       sb.append(this.name);
977     }
978     first = false;
979     if (!first) sb.append(", ");
980     sb.append("maxVersions:");
981     sb.append(this.maxVersions);
982     first = false;
983     if (!first) sb.append(", ");
984     sb.append("compression:");
985     if (this.compression == null) {
986       sb.append("null");
987     } else {
988       sb.append(this.compression);
989     }
990     first = false;
991     if (!first) sb.append(", ");
992     sb.append("inMemory:");
993     sb.append(this.inMemory);
994     first = false;
995     if (!first) sb.append(", ");
996     sb.append("bloomFilterType:");
997     if (this.bloomFilterType == null) {
998       sb.append("null");
999     } else {
1000       sb.append(this.bloomFilterType);
1001     }
1002     first = false;
1003     if (!first) sb.append(", ");
1004     sb.append("bloomFilterVectorSize:");
1005     sb.append(this.bloomFilterVectorSize);
1006     first = false;
1007     if (!first) sb.append(", ");
1008     sb.append("bloomFilterNbHashes:");
1009     sb.append(this.bloomFilterNbHashes);
1010     first = false;
1011     if (!first) sb.append(", ");
1012     sb.append("blockCacheEnabled:");
1013     sb.append(this.blockCacheEnabled);
1014     first = false;
1015     if (!first) sb.append(", ");
1016     sb.append("timeToLive:");
1017     sb.append(this.timeToLive);
1018     first = false;
1019     sb.append(")");
1020     return sb.toString();
1021   }
1022 
1023   public void validate() throws TException {
1024     // check for required fields
1025   }
1026 
1027 }
1028