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