/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package test.fixtures.basic;

import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
import java.util.Collections;
import java.util.BitSet;
import java.util.Arrays;
import com.facebook.thrift.*;
import com.facebook.thrift.annotations.*;
import com.facebook.thrift.async.*;
import com.facebook.thrift.meta_data.*;
import com.facebook.thrift.server.*;
import com.facebook.thrift.transport.*;
import com.facebook.thrift.protocol.*;

@SuppressWarnings({ "unused", "serial" })
public class MyStruct implements TBase, java.io.Serializable, Cloneable, Comparable<MyStruct> {
  private static final TStruct STRUCT_DESC = new TStruct("MyStruct");
  private static final TField MY_INT_FIELD_FIELD_DESC = new TField("MyIntField", TType.I64, (short)1);
  private static final TField MY_STRING_FIELD_FIELD_DESC = new TField("MyStringField", TType.STRING, (short)2);
  private static final TField MY_DATA_FIELD_FIELD_DESC = new TField("MyDataField", TType.STRUCT, (short)3);
  private static final TField MY_ENUM_FIELD_DESC = new TField("myEnum", TType.I32, (short)4);
  private static final TField ONEWAY_FIELD_DESC = new TField("oneway", TType.BOOL, (short)5);
  private static final TField READONLY_FIELD_DESC = new TField("readonly", TType.BOOL, (short)6);
  private static final TField IDEMPOTENT_FIELD_DESC = new TField("idempotent", TType.BOOL, (short)7);
  private static final TField FLOAT_SET_FIELD_DESC = new TField("floatSet", TType.SET, (short)8);
  private static final TField NO_HACK_CODEGEN_FIELD_FIELD_DESC = new TField("no_hack_codegen_field", TType.STRING, (short)9);

  public long MyIntField;
  public String MyStringField;
  public MyDataItem MyDataField;
  /**
   * 
   * @see MyEnum
   */
  public MyEnum myEnum;
  public boolean oneway;
  public boolean readonly;
  public boolean idempotent;
  public Set<Float> floatSet;
  public String no_hack_codegen_field;
  public static final int MYINTFIELD = 1;
  public static final int MYSTRINGFIELD = 2;
  public static final int MYDATAFIELD = 3;
  public static final int MYENUM = 4;
  public static final int ONEWAY = 5;
  public static final int READONLY = 6;
  public static final int IDEMPOTENT = 7;
  public static final int FLOATSET = 8;
  public static final int NO_HACK_CODEGEN_FIELD = 9;

  // isset id assignments
  private static final int __MYINTFIELD_ISSET_ID = 0;
  private static final int __ONEWAY_ISSET_ID = 1;
  private static final int __READONLY_ISSET_ID = 2;
  private static final int __IDEMPOTENT_ISSET_ID = 3;
  private BitSet __isset_bit_vector = new BitSet(4);

  public static final Map<Integer, FieldMetaData> metaDataMap;

  static {
    Map<Integer, FieldMetaData> tmpMetaDataMap = new HashMap<Integer, FieldMetaData>();
    tmpMetaDataMap.put(MYINTFIELD, new FieldMetaData("MyIntField", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    tmpMetaDataMap.put(MYSTRINGFIELD, new FieldMetaData("MyStringField", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    tmpMetaDataMap.put(MYDATAFIELD, new FieldMetaData("MyDataField", TFieldRequirementType.DEFAULT, 
        new StructMetaData(TType.STRUCT, MyDataItem.class)));
    tmpMetaDataMap.put(MYENUM, new FieldMetaData("myEnum", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I32)));
    tmpMetaDataMap.put(ONEWAY, new FieldMetaData("oneway", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.BOOL)));
    tmpMetaDataMap.put(READONLY, new FieldMetaData("readonly", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.BOOL)));
    tmpMetaDataMap.put(IDEMPOTENT, new FieldMetaData("idempotent", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.BOOL)));
    tmpMetaDataMap.put(FLOATSET, new FieldMetaData("floatSet", TFieldRequirementType.DEFAULT, 
        new SetMetaData(TType.SET, 
            new FieldValueMetaData(TType.FLOAT))));
    tmpMetaDataMap.put(NO_HACK_CODEGEN_FIELD, new FieldMetaData("no_hack_codegen_field", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap);
  }

  static {
    FieldMetaData.addStructMetaDataMap(MyStruct.class, metaDataMap);
  }

  public MyStruct() {
  }

  public MyStruct(
      long MyIntField,
      String MyStringField,
      MyDataItem MyDataField,
      MyEnum myEnum,
      boolean oneway,
      boolean readonly,
      boolean idempotent,
      Set<Float> floatSet,
      String no_hack_codegen_field) {
    this();
    this.MyIntField = MyIntField;
    setMyIntFieldIsSet(true);
    this.MyStringField = MyStringField;
    this.MyDataField = MyDataField;
    this.myEnum = myEnum;
    this.oneway = oneway;
    setOnewayIsSet(true);
    this.readonly = readonly;
    setReadonlyIsSet(true);
    this.idempotent = idempotent;
    setIdempotentIsSet(true);
    this.floatSet = floatSet;
    this.no_hack_codegen_field = no_hack_codegen_field;
  }

  public static class Builder {
    private long MyIntField;
    private String MyStringField;
    private MyDataItem MyDataField;
    private MyEnum myEnum;
    private boolean oneway;
    private boolean readonly;
    private boolean idempotent;
    private Set<Float> floatSet;
    private String no_hack_codegen_field;

    BitSet __optional_isset = new BitSet(4);

    public Builder() {
    }

    public Builder setMyIntField(final long MyIntField) {
      this.MyIntField = MyIntField;
      __optional_isset.set(__MYINTFIELD_ISSET_ID, true);
      return this;
    }

    public Builder setMyStringField(final String MyStringField) {
      this.MyStringField = MyStringField;
      return this;
    }

    public Builder setMyDataField(final MyDataItem MyDataField) {
      this.MyDataField = MyDataField;
      return this;
    }

    public Builder setMyEnum(final MyEnum myEnum) {
      this.myEnum = myEnum;
      return this;
    }

    public Builder setOneway(final boolean oneway) {
      this.oneway = oneway;
      __optional_isset.set(__ONEWAY_ISSET_ID, true);
      return this;
    }

    public Builder setReadonly(final boolean readonly) {
      this.readonly = readonly;
      __optional_isset.set(__READONLY_ISSET_ID, true);
      return this;
    }

    public Builder setIdempotent(final boolean idempotent) {
      this.idempotent = idempotent;
      __optional_isset.set(__IDEMPOTENT_ISSET_ID, true);
      return this;
    }

    public Builder setFloatSet(final Set<Float> floatSet) {
      this.floatSet = floatSet;
      return this;
    }

    public Builder setNo_hack_codegen_field(final String no_hack_codegen_field) {
      this.no_hack_codegen_field = no_hack_codegen_field;
      return this;
    }

    public MyStruct build() {
      MyStruct result = new MyStruct();
      if (__optional_isset.get(__MYINTFIELD_ISSET_ID)) {
        result.setMyIntField(this.MyIntField);
      }
      result.setMyStringField(this.MyStringField);
      result.setMyDataField(this.MyDataField);
      result.setMyEnum(this.myEnum);
      if (__optional_isset.get(__ONEWAY_ISSET_ID)) {
        result.setOneway(this.oneway);
      }
      if (__optional_isset.get(__READONLY_ISSET_ID)) {
        result.setReadonly(this.readonly);
      }
      if (__optional_isset.get(__IDEMPOTENT_ISSET_ID)) {
        result.setIdempotent(this.idempotent);
      }
      result.setFloatSet(this.floatSet);
      result.setNo_hack_codegen_field(this.no_hack_codegen_field);
      return result;
    }
  }

  public static Builder builder() {
    return new Builder();
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public MyStruct(MyStruct other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.MyIntField = TBaseHelper.deepCopy(other.MyIntField);
    if (other.isSetMyStringField()) {
      this.MyStringField = TBaseHelper.deepCopy(other.MyStringField);
    }
    if (other.isSetMyDataField()) {
      this.MyDataField = TBaseHelper.deepCopy(other.MyDataField);
    }
    if (other.isSetMyEnum()) {
      this.myEnum = TBaseHelper.deepCopy(other.myEnum);
    }
    this.oneway = TBaseHelper.deepCopy(other.oneway);
    this.readonly = TBaseHelper.deepCopy(other.readonly);
    this.idempotent = TBaseHelper.deepCopy(other.idempotent);
    if (other.isSetFloatSet()) {
      this.floatSet = TBaseHelper.deepCopy(other.floatSet);
    }
    if (other.isSetNo_hack_codegen_field()) {
      this.no_hack_codegen_field = TBaseHelper.deepCopy(other.no_hack_codegen_field);
    }
  }

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

  public long getMyIntField() {
    return this.MyIntField;
  }

  public MyStruct setMyIntField(long MyIntField) {
    this.MyIntField = MyIntField;
    setMyIntFieldIsSet(true);
    return this;
  }

  public void unsetMyIntField() {
    __isset_bit_vector.clear(__MYINTFIELD_ISSET_ID);
  }

  // Returns true if field MyIntField is set (has been assigned a value) and false otherwise
  public boolean isSetMyIntField() {
    return __isset_bit_vector.get(__MYINTFIELD_ISSET_ID);
  }

  public void setMyIntFieldIsSet(boolean __value) {
    __isset_bit_vector.set(__MYINTFIELD_ISSET_ID, __value);
  }

  public String getMyStringField() {
    return this.MyStringField;
  }

  public MyStruct setMyStringField(String MyStringField) {
    this.MyStringField = MyStringField;
    return this;
  }

  public void unsetMyStringField() {
    this.MyStringField = null;
  }

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

  public void setMyStringFieldIsSet(boolean __value) {
    if (!__value) {
      this.MyStringField = null;
    }
  }

  public MyDataItem getMyDataField() {
    return this.MyDataField;
  }

  public MyStruct setMyDataField(MyDataItem MyDataField) {
    this.MyDataField = MyDataField;
    return this;
  }

  public void unsetMyDataField() {
    this.MyDataField = null;
  }

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

  public void setMyDataFieldIsSet(boolean __value) {
    if (!__value) {
      this.MyDataField = null;
    }
  }

  /**
   * 
   * @see MyEnum
   */
  public MyEnum getMyEnum() {
    return this.myEnum;
  }

  /**
   * 
   * @see MyEnum
   */
  public MyStruct setMyEnum(MyEnum myEnum) {
    this.myEnum = myEnum;
    return this;
  }

  public void unsetMyEnum() {
    this.myEnum = null;
  }

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

  public void setMyEnumIsSet(boolean __value) {
    if (!__value) {
      this.myEnum = null;
    }
  }

  public boolean isOneway() {
    return this.oneway;
  }

  public MyStruct setOneway(boolean oneway) {
    this.oneway = oneway;
    setOnewayIsSet(true);
    return this;
  }

  public void unsetOneway() {
    __isset_bit_vector.clear(__ONEWAY_ISSET_ID);
  }

  // Returns true if field oneway is set (has been assigned a value) and false otherwise
  public boolean isSetOneway() {
    return __isset_bit_vector.get(__ONEWAY_ISSET_ID);
  }

  public void setOnewayIsSet(boolean __value) {
    __isset_bit_vector.set(__ONEWAY_ISSET_ID, __value);
  }

  public boolean isReadonly() {
    return this.readonly;
  }

  public MyStruct setReadonly(boolean readonly) {
    this.readonly = readonly;
    setReadonlyIsSet(true);
    return this;
  }

  public void unsetReadonly() {
    __isset_bit_vector.clear(__READONLY_ISSET_ID);
  }

  // Returns true if field readonly is set (has been assigned a value) and false otherwise
  public boolean isSetReadonly() {
    return __isset_bit_vector.get(__READONLY_ISSET_ID);
  }

  public void setReadonlyIsSet(boolean __value) {
    __isset_bit_vector.set(__READONLY_ISSET_ID, __value);
  }

  public boolean isIdempotent() {
    return this.idempotent;
  }

  public MyStruct setIdempotent(boolean idempotent) {
    this.idempotent = idempotent;
    setIdempotentIsSet(true);
    return this;
  }

  public void unsetIdempotent() {
    __isset_bit_vector.clear(__IDEMPOTENT_ISSET_ID);
  }

  // Returns true if field idempotent is set (has been assigned a value) and false otherwise
  public boolean isSetIdempotent() {
    return __isset_bit_vector.get(__IDEMPOTENT_ISSET_ID);
  }

  public void setIdempotentIsSet(boolean __value) {
    __isset_bit_vector.set(__IDEMPOTENT_ISSET_ID, __value);
  }

  public Set<Float> getFloatSet() {
    return this.floatSet;
  }

  public MyStruct setFloatSet(Set<Float> floatSet) {
    this.floatSet = floatSet;
    return this;
  }

  public void unsetFloatSet() {
    this.floatSet = null;
  }

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

  public void setFloatSetIsSet(boolean __value) {
    if (!__value) {
      this.floatSet = null;
    }
  }

  public String getNo_hack_codegen_field() {
    return this.no_hack_codegen_field;
  }

  public MyStruct setNo_hack_codegen_field(String no_hack_codegen_field) {
    this.no_hack_codegen_field = no_hack_codegen_field;
    return this;
  }

  public void unsetNo_hack_codegen_field() {
    this.no_hack_codegen_field = null;
  }

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

  public void setNo_hack_codegen_fieldIsSet(boolean __value) {
    if (!__value) {
      this.no_hack_codegen_field = null;
    }
  }

  @SuppressWarnings("unchecked")
  public void setFieldValue(int fieldID, Object __value) {
    switch (fieldID) {
    case MYINTFIELD:
      if (__value == null) {
        unsetMyIntField();
      } else {
        setMyIntField((Long)__value);
      }
      break;

    case MYSTRINGFIELD:
      if (__value == null) {
        unsetMyStringField();
      } else {
        setMyStringField((String)__value);
      }
      break;

    case MYDATAFIELD:
      if (__value == null) {
        unsetMyDataField();
      } else {
        setMyDataField((MyDataItem)__value);
      }
      break;

    case MYENUM:
      if (__value == null) {
        unsetMyEnum();
      } else {
        setMyEnum((MyEnum)__value);
      }
      break;

    case ONEWAY:
      if (__value == null) {
        unsetOneway();
      } else {
        setOneway((Boolean)__value);
      }
      break;

    case READONLY:
      if (__value == null) {
        unsetReadonly();
      } else {
        setReadonly((Boolean)__value);
      }
      break;

    case IDEMPOTENT:
      if (__value == null) {
        unsetIdempotent();
      } else {
        setIdempotent((Boolean)__value);
      }
      break;

    case FLOATSET:
      if (__value == null) {
        unsetFloatSet();
      } else {
        setFloatSet((Set<Float>)__value);
      }
      break;

    case NO_HACK_CODEGEN_FIELD:
      if (__value == null) {
        unsetNo_hack_codegen_field();
      } else {
        setNo_hack_codegen_field((String)__value);
      }
      break;

    default:
      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
    }
  }

  public Object getFieldValue(int fieldID) {
    switch (fieldID) {
    case MYINTFIELD:
      return new Long(getMyIntField());

    case MYSTRINGFIELD:
      return getMyStringField();

    case MYDATAFIELD:
      return getMyDataField();

    case MYENUM:
      return getMyEnum();

    case ONEWAY:
      return new Boolean(isOneway());

    case READONLY:
      return new Boolean(isReadonly());

    case IDEMPOTENT:
      return new Boolean(isIdempotent());

    case FLOATSET:
      return getFloatSet();

    case NO_HACK_CODEGEN_FIELD:
      return getNo_hack_codegen_field();

    default:
      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
    }
  }

  @Override
  public boolean equals(Object _that) {
    if (_that == null)
      return false;
    if (this == _that)
      return true;
    if (!(_that instanceof MyStruct))
      return false;
    MyStruct that = (MyStruct)_that;

    if (!TBaseHelper.equalsNobinary(this.MyIntField, that.MyIntField)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetMyStringField(), that.isSetMyStringField(), this.MyStringField, that.MyStringField)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetMyDataField(), that.isSetMyDataField(), this.MyDataField, that.MyDataField)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetMyEnum(), that.isSetMyEnum(), this.myEnum, that.myEnum)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.oneway, that.oneway)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.readonly, that.readonly)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.idempotent, that.idempotent)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetFloatSet(), that.isSetFloatSet(), this.floatSet, that.floatSet)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetNo_hack_codegen_field(), that.isSetNo_hack_codegen_field(), this.no_hack_codegen_field, that.no_hack_codegen_field)) { return false; }

    return true;
  }

  @Override
  public int hashCode() {
    return Arrays.deepHashCode(new Object[] {MyIntField, MyStringField, MyDataField, myEnum, oneway, readonly, idempotent, floatSet, no_hack_codegen_field});
  }

  @Override
  public int compareTo(MyStruct other) {
    if (other == null) {
      // See java.lang.Comparable docs
      throw new NullPointerException();
    }

    if (other == this) {
      return 0;
    }
    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetMyIntField()).compareTo(other.isSetMyIntField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(MyIntField, other.MyIntField);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetMyStringField()).compareTo(other.isSetMyStringField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(MyStringField, other.MyStringField);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetMyDataField()).compareTo(other.isSetMyDataField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(MyDataField, other.MyDataField);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetMyEnum()).compareTo(other.isSetMyEnum());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(myEnum, other.myEnum);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOneway()).compareTo(other.isSetOneway());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(oneway, other.oneway);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetReadonly()).compareTo(other.isSetReadonly());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(readonly, other.readonly);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetIdempotent()).compareTo(other.isSetIdempotent());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(idempotent, other.idempotent);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetFloatSet()).compareTo(other.isSetFloatSet());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(floatSet, other.floatSet);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetNo_hack_codegen_field()).compareTo(other.isSetNo_hack_codegen_field());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(no_hack_codegen_field, other.no_hack_codegen_field);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    return 0;
  }

  public void read(TProtocol iprot) throws TException {
    TField __field;
    iprot.readStructBegin(metaDataMap);
    while (true)
    {
      __field = iprot.readFieldBegin();
      if (__field.type == TType.STOP) {
        break;
      }
      switch (__field.id)
      {
        case MYINTFIELD:
          if (__field.type == TType.I64) {
            this.MyIntField = iprot.readI64();
            setMyIntFieldIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case MYSTRINGFIELD:
          if (__field.type == TType.STRING) {
            this.MyStringField = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case MYDATAFIELD:
          if (__field.type == TType.STRUCT) {
            this.MyDataField = new MyDataItem();
            this.MyDataField.read(iprot);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case MYENUM:
          if (__field.type == TType.I32) {
            this.myEnum = MyEnum.findByValue(iprot.readI32());
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case ONEWAY:
          if (__field.type == TType.BOOL) {
            this.oneway = iprot.readBool();
            setOnewayIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case READONLY:
          if (__field.type == TType.BOOL) {
            this.readonly = iprot.readBool();
            setReadonlyIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case IDEMPOTENT:
          if (__field.type == TType.BOOL) {
            this.idempotent = iprot.readBool();
            setIdempotentIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case FLOATSET:
          if (__field.type == TType.SET) {
            {
              TSet _set0 = iprot.readSetBegin();
              this.floatSet = new HashSet<Float>(Math.max(0, 2*_set0.size));
              for (int _i1 = 0; 
                   (_set0.size < 0) ? iprot.peekSet() : (_i1 < _set0.size); 
                   ++_i1)
              {
                float _elem2;
                _elem2 = iprot.readFloat();
                this.floatSet.add(_elem2);
              }
              iprot.readSetEnd();
            }
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case NO_HACK_CODEGEN_FIELD:
          if (__field.type == TType.STRING) {
            this.no_hack_codegen_field = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        default:
          TProtocolUtil.skip(iprot, __field.type);
          break;
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();


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

  public void write(TProtocol oprot) throws TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(MY_INT_FIELD_FIELD_DESC);
    oprot.writeI64(this.MyIntField);
    oprot.writeFieldEnd();
    if (this.MyStringField != null) {
      oprot.writeFieldBegin(MY_STRING_FIELD_FIELD_DESC);
      oprot.writeString(this.MyStringField);
      oprot.writeFieldEnd();
    }
    if (this.MyDataField != null) {
      oprot.writeFieldBegin(MY_DATA_FIELD_FIELD_DESC);
      this.MyDataField.write(oprot);
      oprot.writeFieldEnd();
    }
    if (this.myEnum != null) {
      oprot.writeFieldBegin(MY_ENUM_FIELD_DESC);
      oprot.writeI32(this.myEnum == null ? 0 : this.myEnum.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(ONEWAY_FIELD_DESC);
    oprot.writeBool(this.oneway);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(READONLY_FIELD_DESC);
    oprot.writeBool(this.readonly);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(IDEMPOTENT_FIELD_DESC);
    oprot.writeBool(this.idempotent);
    oprot.writeFieldEnd();
    if (this.floatSet != null) {
      oprot.writeFieldBegin(FLOAT_SET_FIELD_DESC);
      {
        oprot.writeSetBegin(new TSet(TType.FLOAT, this.floatSet.size()));
        for (float _iter3 : this.floatSet)        {
          oprot.writeFloat(_iter3);
        }
        oprot.writeSetEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.no_hack_codegen_field != null) {
      oprot.writeFieldBegin(NO_HACK_CODEGEN_FIELD_FIELD_DESC);
      oprot.writeString(this.no_hack_codegen_field);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @Override
  public String toString() {
    return toString(1, true);
  }

  @Override
  public String toString(int indent, boolean prettyPrint) {
    String indentStr = prettyPrint ? TBaseHelper.getIndentedString(indent) : "";
    String newLine = prettyPrint ? "\n" : "";
    String space = prettyPrint ? " " : "";
    StringBuilder sb = new StringBuilder("MyStruct");
    sb.append(space);
    sb.append("(");
    sb.append(newLine);
    boolean first = true;

    sb.append(indentStr);
    sb.append("MyIntField");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getMyIntField(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("MyStringField");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getMyStringField() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getMyStringField(), indent + 1, prettyPrint));
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("MyDataField");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getMyDataField() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getMyDataField(), indent + 1, prettyPrint));
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("myEnum");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getMyEnum() == null) {
      sb.append("null");
    } else {
      String myEnum_name = this.getMyEnum() == null ? "null" : this.getMyEnum().name();
      if (myEnum_name != null) {
        sb.append(myEnum_name);
        sb.append(" (");
      }
      sb.append(this.getMyEnum());
      if (myEnum_name != null) {
        sb.append(")");
      }
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("oneway");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.isOneway(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("readonly");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.isReadonly(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("idempotent");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.isIdempotent(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("floatSet");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getFloatSet() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getFloatSet(), indent + 1, prettyPrint));
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("no_hack_codegen_field");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getNo_hack_codegen_field() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getNo_hack_codegen_field(), indent + 1, prettyPrint));
    }
    first = false;
    sb.append(newLine + TBaseHelper.reduceIndent(indentStr));
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }

}

