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