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