All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adgear.anoa.test.nested.VariantThrift Maven / Gradle / Ivy

There is a newer version: 3.1.2
Show newest version
/**
 * Autogenerated by Thrift Compiler (0.9.2)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.adgear.anoa.test.nested;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-6-3")
public class VariantThrift implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("VariantThrift");

  private static final org.apache.thrift.protocol.TField INT_VARIANT_FIELD_DESC = new org.apache.thrift.protocol.TField("int_variant", org.apache.thrift.protocol.TType.I32, (short)10);
  private static final org.apache.thrift.protocol.TField LONG_VARIANT_FIELD_DESC = new org.apache.thrift.protocol.TField("long_variant", org.apache.thrift.protocol.TType.I64, (short)20);
  private static final org.apache.thrift.protocol.TField FLOAT_VARIANT_FIELD_DESC = new org.apache.thrift.protocol.TField("float_variant", org.apache.thrift.protocol.TType.DOUBLE, (short)30);
  private static final org.apache.thrift.protocol.TField DOUBLE_VARIANT_FIELD_DESC = new org.apache.thrift.protocol.TField("double_variant", org.apache.thrift.protocol.TType.DOUBLE, (short)40);
  private static final org.apache.thrift.protocol.TField BOOLEAN_VARIANT_FIELD_DESC = new org.apache.thrift.protocol.TField("boolean_variant", org.apache.thrift.protocol.TType.BOOL, (short)50);
  private static final org.apache.thrift.protocol.TField STRING_VARIANT_FIELD_DESC = new org.apache.thrift.protocol.TField("string_variant", org.apache.thrift.protocol.TType.STRING, (short)60);
  private static final org.apache.thrift.protocol.TField BYTES_VARIANT_FIELD_DESC = new org.apache.thrift.protocol.TField("bytes_variant", org.apache.thrift.protocol.TType.STRING, (short)70);

  private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new VariantThriftStandardSchemeFactory());
    schemes.put(TupleScheme.class, new VariantThriftTupleSchemeFactory());
  }

  public int int_variant; // optional
  public long long_variant; // optional
  public double float_variant; // optional
  public double double_variant; // optional
  public boolean boolean_variant; // optional
  public String string_variant; // optional
  public ByteBuffer bytes_variant; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    INT_VARIANT((short)10, "int_variant"),
    LONG_VARIANT((short)20, "long_variant"),
    FLOAT_VARIANT((short)30, "float_variant"),
    DOUBLE_VARIANT((short)40, "double_variant"),
    BOOLEAN_VARIANT((short)50, "boolean_variant"),
    STRING_VARIANT((short)60, "string_variant"),
    BYTES_VARIANT((short)70, "bytes_variant");

    private static final Map byName = new HashMap();

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 10: // INT_VARIANT
          return INT_VARIANT;
        case 20: // LONG_VARIANT
          return LONG_VARIANT;
        case 30: // FLOAT_VARIANT
          return FLOAT_VARIANT;
        case 40: // DOUBLE_VARIANT
          return DOUBLE_VARIANT;
        case 50: // BOOLEAN_VARIANT
          return BOOLEAN_VARIANT;
        case 60: // STRING_VARIANT
          return STRING_VARIANT;
        case 70: // BYTES_VARIANT
          return BYTES_VARIANT;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __INT_VARIANT_ISSET_ID = 0;
  private static final int __LONG_VARIANT_ISSET_ID = 1;
  private static final int __FLOAT_VARIANT_ISSET_ID = 2;
  private static final int __DOUBLE_VARIANT_ISSET_ID = 3;
  private static final int __BOOLEAN_VARIANT_ISSET_ID = 4;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.INT_VARIANT,_Fields.LONG_VARIANT,_Fields.FLOAT_VARIANT,_Fields.DOUBLE_VARIANT,_Fields.BOOLEAN_VARIANT,_Fields.STRING_VARIANT,_Fields.BYTES_VARIANT};
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.INT_VARIANT, new org.apache.thrift.meta_data.FieldMetaData("int_variant", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.LONG_VARIANT, new org.apache.thrift.meta_data.FieldMetaData("long_variant", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.FLOAT_VARIANT, new org.apache.thrift.meta_data.FieldMetaData("float_variant", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.DOUBLE_VARIANT, new org.apache.thrift.meta_data.FieldMetaData("double_variant", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.BOOLEAN_VARIANT, new org.apache.thrift.meta_data.FieldMetaData("boolean_variant", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.STRING_VARIANT, new org.apache.thrift.meta_data.FieldMetaData("string_variant", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.BYTES_VARIANT, new org.apache.thrift.meta_data.FieldMetaData("bytes_variant", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(VariantThrift.class, metaDataMap);
  }

  public VariantThrift() {
    this.int_variant = 1;

    this.long_variant = -1L;

    this.float_variant = -1;

    this.double_variant = -1;

    this.boolean_variant = true;

    this.string_variant = "foo";

    this.bytes_variant = java.nio.ByteBuffer.wrap("\1\2\3".getBytes());

  }

  /**
   * Performs a deep copy on other.
   */
  public VariantThrift(VariantThrift other) {
    __isset_bitfield = other.__isset_bitfield;
    this.int_variant = other.int_variant;
    this.long_variant = other.long_variant;
    this.float_variant = other.float_variant;
    this.double_variant = other.double_variant;
    this.boolean_variant = other.boolean_variant;
    if (other.isSetString_variant()) {
      this.string_variant = other.string_variant;
    }
    if (other.isSetBytes_variant()) {
      this.bytes_variant = org.apache.thrift.TBaseHelper.copyBinary(other.bytes_variant);
    }
  }

  public VariantThrift deepCopy() {
    return new VariantThrift(this);
  }

  @Override
  public void clear() {
    this.int_variant = 1;

    this.long_variant = -1L;

    this.float_variant = -1;

    this.double_variant = -1;

    this.boolean_variant = true;

    this.string_variant = "foo";

    this.bytes_variant = java.nio.ByteBuffer.wrap("\1\2\3".getBytes());

  }

  public int getInt_variant() {
    return this.int_variant;
  }

  public VariantThrift setInt_variant(int int_variant) {
    this.int_variant = int_variant;
    setInt_variantIsSet(true);
    return this;
  }

  public void unsetInt_variant() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __INT_VARIANT_ISSET_ID);
  }

  /** Returns true if field int_variant is set (has been assigned a value) and false otherwise */
  public boolean isSetInt_variant() {
    return EncodingUtils.testBit(__isset_bitfield, __INT_VARIANT_ISSET_ID);
  }

  public void setInt_variantIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __INT_VARIANT_ISSET_ID, value);
  }

  public long getLong_variant() {
    return this.long_variant;
  }

  public VariantThrift setLong_variant(long long_variant) {
    this.long_variant = long_variant;
    setLong_variantIsSet(true);
    return this;
  }

  public void unsetLong_variant() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LONG_VARIANT_ISSET_ID);
  }

  /** Returns true if field long_variant is set (has been assigned a value) and false otherwise */
  public boolean isSetLong_variant() {
    return EncodingUtils.testBit(__isset_bitfield, __LONG_VARIANT_ISSET_ID);
  }

  public void setLong_variantIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LONG_VARIANT_ISSET_ID, value);
  }

  public double getFloat_variant() {
    return this.float_variant;
  }

  public VariantThrift setFloat_variant(double float_variant) {
    this.float_variant = float_variant;
    setFloat_variantIsSet(true);
    return this;
  }

  public void unsetFloat_variant() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FLOAT_VARIANT_ISSET_ID);
  }

  /** Returns true if field float_variant is set (has been assigned a value) and false otherwise */
  public boolean isSetFloat_variant() {
    return EncodingUtils.testBit(__isset_bitfield, __FLOAT_VARIANT_ISSET_ID);
  }

  public void setFloat_variantIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FLOAT_VARIANT_ISSET_ID, value);
  }

  public double getDouble_variant() {
    return this.double_variant;
  }

  public VariantThrift setDouble_variant(double double_variant) {
    this.double_variant = double_variant;
    setDouble_variantIsSet(true);
    return this;
  }

  public void unsetDouble_variant() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DOUBLE_VARIANT_ISSET_ID);
  }

  /** Returns true if field double_variant is set (has been assigned a value) and false otherwise */
  public boolean isSetDouble_variant() {
    return EncodingUtils.testBit(__isset_bitfield, __DOUBLE_VARIANT_ISSET_ID);
  }

  public void setDouble_variantIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DOUBLE_VARIANT_ISSET_ID, value);
  }

  public boolean isBoolean_variant() {
    return this.boolean_variant;
  }

  public VariantThrift setBoolean_variant(boolean boolean_variant) {
    this.boolean_variant = boolean_variant;
    setBoolean_variantIsSet(true);
    return this;
  }

  public void unsetBoolean_variant() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BOOLEAN_VARIANT_ISSET_ID);
  }

  /** Returns true if field boolean_variant is set (has been assigned a value) and false otherwise */
  public boolean isSetBoolean_variant() {
    return EncodingUtils.testBit(__isset_bitfield, __BOOLEAN_VARIANT_ISSET_ID);
  }

  public void setBoolean_variantIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BOOLEAN_VARIANT_ISSET_ID, value);
  }

  public String getString_variant() {
    return this.string_variant;
  }

  public VariantThrift setString_variant(String string_variant) {
    this.string_variant = string_variant;
    return this;
  }

  public void unsetString_variant() {
    this.string_variant = null;
  }

  /** Returns true if field string_variant is set (has been assigned a value) and false otherwise */
  public boolean isSetString_variant() {
    return this.string_variant != null;
  }

  public void setString_variantIsSet(boolean value) {
    if (!value) {
      this.string_variant = null;
    }
  }

  public byte[] getBytes_variant() {
    setBytes_variant(org.apache.thrift.TBaseHelper.rightSize(bytes_variant));
    return bytes_variant == null ? null : bytes_variant.array();
  }

  public ByteBuffer bufferForBytes_variant() {
    return org.apache.thrift.TBaseHelper.copyBinary(bytes_variant);
  }

  public VariantThrift setBytes_variant(byte[] bytes_variant) {
    this.bytes_variant = bytes_variant == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(bytes_variant, bytes_variant.length));
    return this;
  }

  public VariantThrift setBytes_variant(ByteBuffer bytes_variant) {
    this.bytes_variant = org.apache.thrift.TBaseHelper.copyBinary(bytes_variant);
    return this;
  }

  public void unsetBytes_variant() {
    this.bytes_variant = null;
  }

  /** Returns true if field bytes_variant is set (has been assigned a value) and false otherwise */
  public boolean isSetBytes_variant() {
    return this.bytes_variant != null;
  }

  public void setBytes_variantIsSet(boolean value) {
    if (!value) {
      this.bytes_variant = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case INT_VARIANT:
      if (value == null) {
        unsetInt_variant();
      } else {
        setInt_variant((Integer)value);
      }
      break;

    case LONG_VARIANT:
      if (value == null) {
        unsetLong_variant();
      } else {
        setLong_variant((Long)value);
      }
      break;

    case FLOAT_VARIANT:
      if (value == null) {
        unsetFloat_variant();
      } else {
        setFloat_variant((Double)value);
      }
      break;

    case DOUBLE_VARIANT:
      if (value == null) {
        unsetDouble_variant();
      } else {
        setDouble_variant((Double)value);
      }
      break;

    case BOOLEAN_VARIANT:
      if (value == null) {
        unsetBoolean_variant();
      } else {
        setBoolean_variant((Boolean)value);
      }
      break;

    case STRING_VARIANT:
      if (value == null) {
        unsetString_variant();
      } else {
        setString_variant((String)value);
      }
      break;

    case BYTES_VARIANT:
      if (value == null) {
        unsetBytes_variant();
      } else {
        setBytes_variant((ByteBuffer)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case INT_VARIANT:
      return Integer.valueOf(getInt_variant());

    case LONG_VARIANT:
      return Long.valueOf(getLong_variant());

    case FLOAT_VARIANT:
      return Double.valueOf(getFloat_variant());

    case DOUBLE_VARIANT:
      return Double.valueOf(getDouble_variant());

    case BOOLEAN_VARIANT:
      return Boolean.valueOf(isBoolean_variant());

    case STRING_VARIANT:
      return getString_variant();

    case BYTES_VARIANT:
      return getBytes_variant();

    }
    throw new IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case INT_VARIANT:
      return isSetInt_variant();
    case LONG_VARIANT:
      return isSetLong_variant();
    case FLOAT_VARIANT:
      return isSetFloat_variant();
    case DOUBLE_VARIANT:
      return isSetDouble_variant();
    case BOOLEAN_VARIANT:
      return isSetBoolean_variant();
    case STRING_VARIANT:
      return isSetString_variant();
    case BYTES_VARIANT:
      return isSetBytes_variant();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof VariantThrift)
      return this.equals((VariantThrift)that);
    return false;
  }

  public boolean equals(VariantThrift that) {
    if (that == null)
      return false;

    boolean this_present_int_variant = true && this.isSetInt_variant();
    boolean that_present_int_variant = true && that.isSetInt_variant();
    if (this_present_int_variant || that_present_int_variant) {
      if (!(this_present_int_variant && that_present_int_variant))
        return false;
      if (this.int_variant != that.int_variant)
        return false;
    }

    boolean this_present_long_variant = true && this.isSetLong_variant();
    boolean that_present_long_variant = true && that.isSetLong_variant();
    if (this_present_long_variant || that_present_long_variant) {
      if (!(this_present_long_variant && that_present_long_variant))
        return false;
      if (this.long_variant != that.long_variant)
        return false;
    }

    boolean this_present_float_variant = true && this.isSetFloat_variant();
    boolean that_present_float_variant = true && that.isSetFloat_variant();
    if (this_present_float_variant || that_present_float_variant) {
      if (!(this_present_float_variant && that_present_float_variant))
        return false;
      if (this.float_variant != that.float_variant)
        return false;
    }

    boolean this_present_double_variant = true && this.isSetDouble_variant();
    boolean that_present_double_variant = true && that.isSetDouble_variant();
    if (this_present_double_variant || that_present_double_variant) {
      if (!(this_present_double_variant && that_present_double_variant))
        return false;
      if (this.double_variant != that.double_variant)
        return false;
    }

    boolean this_present_boolean_variant = true && this.isSetBoolean_variant();
    boolean that_present_boolean_variant = true && that.isSetBoolean_variant();
    if (this_present_boolean_variant || that_present_boolean_variant) {
      if (!(this_present_boolean_variant && that_present_boolean_variant))
        return false;
      if (this.boolean_variant != that.boolean_variant)
        return false;
    }

    boolean this_present_string_variant = true && this.isSetString_variant();
    boolean that_present_string_variant = true && that.isSetString_variant();
    if (this_present_string_variant || that_present_string_variant) {
      if (!(this_present_string_variant && that_present_string_variant))
        return false;
      if (!this.string_variant.equals(that.string_variant))
        return false;
    }

    boolean this_present_bytes_variant = true && this.isSetBytes_variant();
    boolean that_present_bytes_variant = true && that.isSetBytes_variant();
    if (this_present_bytes_variant || that_present_bytes_variant) {
      if (!(this_present_bytes_variant && that_present_bytes_variant))
        return false;
      if (!this.bytes_variant.equals(that.bytes_variant))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    List list = new ArrayList();

    boolean present_int_variant = true && (isSetInt_variant());
    list.add(present_int_variant);
    if (present_int_variant)
      list.add(int_variant);

    boolean present_long_variant = true && (isSetLong_variant());
    list.add(present_long_variant);
    if (present_long_variant)
      list.add(long_variant);

    boolean present_float_variant = true && (isSetFloat_variant());
    list.add(present_float_variant);
    if (present_float_variant)
      list.add(float_variant);

    boolean present_double_variant = true && (isSetDouble_variant());
    list.add(present_double_variant);
    if (present_double_variant)
      list.add(double_variant);

    boolean present_boolean_variant = true && (isSetBoolean_variant());
    list.add(present_boolean_variant);
    if (present_boolean_variant)
      list.add(boolean_variant);

    boolean present_string_variant = true && (isSetString_variant());
    list.add(present_string_variant);
    if (present_string_variant)
      list.add(string_variant);

    boolean present_bytes_variant = true && (isSetBytes_variant());
    list.add(present_bytes_variant);
    if (present_bytes_variant)
      list.add(bytes_variant);

    return list.hashCode();
  }

  @Override
  public int compareTo(VariantThrift other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetInt_variant()).compareTo(other.isSetInt_variant());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetInt_variant()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.int_variant, other.int_variant);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetLong_variant()).compareTo(other.isSetLong_variant());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLong_variant()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.long_variant, other.long_variant);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFloat_variant()).compareTo(other.isSetFloat_variant());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFloat_variant()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.float_variant, other.float_variant);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDouble_variant()).compareTo(other.isSetDouble_variant());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDouble_variant()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.double_variant, other.double_variant);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBoolean_variant()).compareTo(other.isSetBoolean_variant());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBoolean_variant()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.boolean_variant, other.boolean_variant);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetString_variant()).compareTo(other.isSetString_variant());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetString_variant()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.string_variant, other.string_variant);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBytes_variant()).compareTo(other.isSetBytes_variant());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBytes_variant()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bytes_variant, other.bytes_variant);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("VariantThrift(");
    boolean first = true;

    if (isSetInt_variant()) {
      sb.append("int_variant:");
      sb.append(this.int_variant);
      first = false;
    }
    if (isSetLong_variant()) {
      if (!first) sb.append(", ");
      sb.append("long_variant:");
      sb.append(this.long_variant);
      first = false;
    }
    if (isSetFloat_variant()) {
      if (!first) sb.append(", ");
      sb.append("float_variant:");
      sb.append(this.float_variant);
      first = false;
    }
    if (isSetDouble_variant()) {
      if (!first) sb.append(", ");
      sb.append("double_variant:");
      sb.append(this.double_variant);
      first = false;
    }
    if (isSetBoolean_variant()) {
      if (!first) sb.append(", ");
      sb.append("boolean_variant:");
      sb.append(this.boolean_variant);
      first = false;
    }
    if (isSetString_variant()) {
      if (!first) sb.append(", ");
      sb.append("string_variant:");
      if (this.string_variant == null) {
        sb.append("null");
      } else {
        sb.append(this.string_variant);
      }
      first = false;
    }
    if (isSetBytes_variant()) {
      if (!first) sb.append(", ");
      sb.append("bytes_variant:");
      if (this.bytes_variant == null) {
        sb.append("null");
      } else {
        org.apache.thrift.TBaseHelper.toString(this.bytes_variant, sb);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class VariantThriftStandardSchemeFactory implements SchemeFactory {
    public VariantThriftStandardScheme getScheme() {
      return new VariantThriftStandardScheme();
    }
  }

  private static class VariantThriftStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, VariantThrift struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 10: // INT_VARIANT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.int_variant = iprot.readI32();
              struct.setInt_variantIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 20: // LONG_VARIANT
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.long_variant = iprot.readI64();
              struct.setLong_variantIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 30: // FLOAT_VARIANT
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.float_variant = iprot.readDouble();
              struct.setFloat_variantIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 40: // DOUBLE_VARIANT
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.double_variant = iprot.readDouble();
              struct.setDouble_variantIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 50: // BOOLEAN_VARIANT
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.boolean_variant = iprot.readBool();
              struct.setBoolean_variantIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 60: // STRING_VARIANT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.string_variant = iprot.readString();
              struct.setString_variantIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 70: // BYTES_VARIANT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.bytes_variant = iprot.readBinary();
              struct.setBytes_variantIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, VariantThrift struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.isSetInt_variant()) {
        oprot.writeFieldBegin(INT_VARIANT_FIELD_DESC);
        oprot.writeI32(struct.int_variant);
        oprot.writeFieldEnd();
      }
      if (struct.isSetLong_variant()) {
        oprot.writeFieldBegin(LONG_VARIANT_FIELD_DESC);
        oprot.writeI64(struct.long_variant);
        oprot.writeFieldEnd();
      }
      if (struct.isSetFloat_variant()) {
        oprot.writeFieldBegin(FLOAT_VARIANT_FIELD_DESC);
        oprot.writeDouble(struct.float_variant);
        oprot.writeFieldEnd();
      }
      if (struct.isSetDouble_variant()) {
        oprot.writeFieldBegin(DOUBLE_VARIANT_FIELD_DESC);
        oprot.writeDouble(struct.double_variant);
        oprot.writeFieldEnd();
      }
      if (struct.isSetBoolean_variant()) {
        oprot.writeFieldBegin(BOOLEAN_VARIANT_FIELD_DESC);
        oprot.writeBool(struct.boolean_variant);
        oprot.writeFieldEnd();
      }
      if (struct.string_variant != null) {
        if (struct.isSetString_variant()) {
          oprot.writeFieldBegin(STRING_VARIANT_FIELD_DESC);
          oprot.writeString(struct.string_variant);
          oprot.writeFieldEnd();
        }
      }
      if (struct.bytes_variant != null) {
        if (struct.isSetBytes_variant()) {
          oprot.writeFieldBegin(BYTES_VARIANT_FIELD_DESC);
          oprot.writeBinary(struct.bytes_variant);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class VariantThriftTupleSchemeFactory implements SchemeFactory {
    public VariantThriftTupleScheme getScheme() {
      return new VariantThriftTupleScheme();
    }
  }

  private static class VariantThriftTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, VariantThrift struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetInt_variant()) {
        optionals.set(0);
      }
      if (struct.isSetLong_variant()) {
        optionals.set(1);
      }
      if (struct.isSetFloat_variant()) {
        optionals.set(2);
      }
      if (struct.isSetDouble_variant()) {
        optionals.set(3);
      }
      if (struct.isSetBoolean_variant()) {
        optionals.set(4);
      }
      if (struct.isSetString_variant()) {
        optionals.set(5);
      }
      if (struct.isSetBytes_variant()) {
        optionals.set(6);
      }
      oprot.writeBitSet(optionals, 7);
      if (struct.isSetInt_variant()) {
        oprot.writeI32(struct.int_variant);
      }
      if (struct.isSetLong_variant()) {
        oprot.writeI64(struct.long_variant);
      }
      if (struct.isSetFloat_variant()) {
        oprot.writeDouble(struct.float_variant);
      }
      if (struct.isSetDouble_variant()) {
        oprot.writeDouble(struct.double_variant);
      }
      if (struct.isSetBoolean_variant()) {
        oprot.writeBool(struct.boolean_variant);
      }
      if (struct.isSetString_variant()) {
        oprot.writeString(struct.string_variant);
      }
      if (struct.isSetBytes_variant()) {
        oprot.writeBinary(struct.bytes_variant);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, VariantThrift struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(7);
      if (incoming.get(0)) {
        struct.int_variant = iprot.readI32();
        struct.setInt_variantIsSet(true);
      }
      if (incoming.get(1)) {
        struct.long_variant = iprot.readI64();
        struct.setLong_variantIsSet(true);
      }
      if (incoming.get(2)) {
        struct.float_variant = iprot.readDouble();
        struct.setFloat_variantIsSet(true);
      }
      if (incoming.get(3)) {
        struct.double_variant = iprot.readDouble();
        struct.setDouble_variantIsSet(true);
      }
      if (incoming.get(4)) {
        struct.boolean_variant = iprot.readBool();
        struct.setBoolean_variantIsSet(true);
      }
      if (incoming.get(5)) {
        struct.string_variant = iprot.readString();
        struct.setString_variantIsSet(true);
      }
      if (incoming.get(6)) {
        struct.bytes_variant = iprot.readBinary();
        struct.setBytes_variantIsSet(true);
      }
    }
  }

}