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

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 AdaptTestStruct implements TBase, java.io.Serializable, Cloneable, Comparable<AdaptTestStruct> {
  private static final TStruct STRUCT_DESC = new TStruct("AdaptTestStruct");
  private static final TField DELAY_FIELD_DESC = new TField("delay", TType.I64, (short)1);
  private static final TField CUSTOM_FIELD_DESC = new TField("custom", TType.STRING, (short)2);
  private static final TField TIMEOUT_FIELD_DESC = new TField("timeout", TType.I64, (short)3);
  private static final TField DATA_FIELD_DESC = new TField("data", TType.I64, (short)4);
  private static final TField META_FIELD_DESC = new TField("meta", TType.STRING, (short)5);
  private static final TField INDIRECTION_STRING_FIELD_DESC = new TField("indirectionString", TType.STRING, (short)6);
  private static final TField STRING_DATA_FIELD_DESC = new TField("string_data", TType.STRING, (short)7);
  private static final TField DOUBLE_WRAPPED_BOOL_FIELD_DESC = new TField("double_wrapped_bool", TType.BOOL, (short)8);
  private static final TField DOUBLE_WRAPPED_INTEGER_FIELD_DESC = new TField("double_wrapped_integer", TType.I32, (short)9);
  private static final TField BINARY_DATA_FIELD_DESC = new TField("binary_data", TType.STRING, (short)10);

  public long delay;
  public byte[] custom;
  public long timeout;
  public long data;
  public String meta;
  public String indirectionString;
  public String string_data;
  public boolean double_wrapped_bool;
  public int double_wrapped_integer;
  public byte[] binary_data;
  public static final int DELAY = 1;
  public static final int CUSTOM = 2;
  public static final int TIMEOUT = 3;
  public static final int DATA = 4;
  public static final int META = 5;
  public static final int INDIRECTIONSTRING = 6;
  public static final int STRING_DATA = 7;
  public static final int DOUBLE_WRAPPED_BOOL = 8;
  public static final int DOUBLE_WRAPPED_INTEGER = 9;
  public static final int BINARY_DATA = 10;

  // isset id assignments
  private static final int __DELAY_ISSET_ID = 0;
  private static final int __TIMEOUT_ISSET_ID = 1;
  private static final int __DATA_ISSET_ID = 2;
  private static final int __DOUBLE_WRAPPED_BOOL_ISSET_ID = 3;
  private static final int __DOUBLE_WRAPPED_INTEGER_ISSET_ID = 4;
  private BitSet __isset_bit_vector = new BitSet(5);

  public static final Map<Integer, FieldMetaData> metaDataMap;

  static {
    Map<Integer, FieldMetaData> tmpMetaDataMap = new HashMap<Integer, FieldMetaData>();
    tmpMetaDataMap.put(DELAY, new FieldMetaData("delay", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    tmpMetaDataMap.put(CUSTOM, new FieldMetaData("custom", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    tmpMetaDataMap.put(TIMEOUT, new FieldMetaData("timeout", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    tmpMetaDataMap.put(DATA, new FieldMetaData("data", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    tmpMetaDataMap.put(META, new FieldMetaData("meta", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    tmpMetaDataMap.put(INDIRECTIONSTRING, new FieldMetaData("indirectionString", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    tmpMetaDataMap.put(STRING_DATA, new FieldMetaData("string_data", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    tmpMetaDataMap.put(DOUBLE_WRAPPED_BOOL, new FieldMetaData("double_wrapped_bool", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.BOOL)));
    tmpMetaDataMap.put(DOUBLE_WRAPPED_INTEGER, new FieldMetaData("double_wrapped_integer", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I32)));
    tmpMetaDataMap.put(BINARY_DATA, new FieldMetaData("binary_data", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap);
  }

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

  public AdaptTestStruct() {
  }

  public AdaptTestStruct(
      long delay,
      byte[] custom,
      long timeout,
      long data,
      String meta,
      String indirectionString,
      String string_data,
      boolean double_wrapped_bool,
      int double_wrapped_integer,
      byte[] binary_data) {
    this();
    this.delay = delay;
    setDelayIsSet(true);
    this.custom = custom;
    this.timeout = timeout;
    setTimeoutIsSet(true);
    this.data = data;
    setDataIsSet(true);
    this.meta = meta;
    this.indirectionString = indirectionString;
    this.string_data = string_data;
    this.double_wrapped_bool = double_wrapped_bool;
    setDouble_wrapped_boolIsSet(true);
    this.double_wrapped_integer = double_wrapped_integer;
    setDouble_wrapped_integerIsSet(true);
    this.binary_data = binary_data;
  }

  public static class Builder {
    private long delay;
    private byte[] custom;
    private long timeout;
    private long data;
    private String meta;
    private String indirectionString;
    private String string_data;
    private boolean double_wrapped_bool;
    private int double_wrapped_integer;
    private byte[] binary_data;

    BitSet __optional_isset = new BitSet(5);

    public Builder() {
    }

    public Builder setDelay(final long delay) {
      this.delay = delay;
      __optional_isset.set(__DELAY_ISSET_ID, true);
      return this;
    }

    public Builder setCustom(final byte[] custom) {
      this.custom = custom;
      return this;
    }

    public Builder setTimeout(final long timeout) {
      this.timeout = timeout;
      __optional_isset.set(__TIMEOUT_ISSET_ID, true);
      return this;
    }

    public Builder setData(final long data) {
      this.data = data;
      __optional_isset.set(__DATA_ISSET_ID, true);
      return this;
    }

    public Builder setMeta(final String meta) {
      this.meta = meta;
      return this;
    }

    public Builder setIndirectionString(final String indirectionString) {
      this.indirectionString = indirectionString;
      return this;
    }

    public Builder setString_data(final String string_data) {
      this.string_data = string_data;
      return this;
    }

    public Builder setDouble_wrapped_bool(final boolean double_wrapped_bool) {
      this.double_wrapped_bool = double_wrapped_bool;
      __optional_isset.set(__DOUBLE_WRAPPED_BOOL_ISSET_ID, true);
      return this;
    }

    public Builder setDouble_wrapped_integer(final int double_wrapped_integer) {
      this.double_wrapped_integer = double_wrapped_integer;
      __optional_isset.set(__DOUBLE_WRAPPED_INTEGER_ISSET_ID, true);
      return this;
    }

    public Builder setBinary_data(final byte[] binary_data) {
      this.binary_data = binary_data;
      return this;
    }

    public AdaptTestStruct build() {
      AdaptTestStruct result = new AdaptTestStruct();
      if (__optional_isset.get(__DELAY_ISSET_ID)) {
        result.setDelay(this.delay);
      }
      result.setCustom(this.custom);
      if (__optional_isset.get(__TIMEOUT_ISSET_ID)) {
        result.setTimeout(this.timeout);
      }
      if (__optional_isset.get(__DATA_ISSET_ID)) {
        result.setData(this.data);
      }
      result.setMeta(this.meta);
      result.setIndirectionString(this.indirectionString);
      result.setString_data(this.string_data);
      if (__optional_isset.get(__DOUBLE_WRAPPED_BOOL_ISSET_ID)) {
        result.setDouble_wrapped_bool(this.double_wrapped_bool);
      }
      if (__optional_isset.get(__DOUBLE_WRAPPED_INTEGER_ISSET_ID)) {
        result.setDouble_wrapped_integer(this.double_wrapped_integer);
      }
      result.setBinary_data(this.binary_data);
      return result;
    }
  }

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

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public AdaptTestStruct(AdaptTestStruct other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.delay = TBaseHelper.deepCopy(other.delay);
    if (other.isSetCustom()) {
      this.custom = TBaseHelper.deepCopy(other.custom);
    }
    this.timeout = TBaseHelper.deepCopy(other.timeout);
    this.data = TBaseHelper.deepCopy(other.data);
    if (other.isSetMeta()) {
      this.meta = TBaseHelper.deepCopy(other.meta);
    }
    if (other.isSetIndirectionString()) {
      this.indirectionString = TBaseHelper.deepCopy(other.indirectionString);
    }
    if (other.isSetString_data()) {
      this.string_data = TBaseHelper.deepCopy(other.string_data);
    }
    this.double_wrapped_bool = TBaseHelper.deepCopy(other.double_wrapped_bool);
    this.double_wrapped_integer = TBaseHelper.deepCopy(other.double_wrapped_integer);
    if (other.isSetBinary_data()) {
      this.binary_data = TBaseHelper.deepCopy(other.binary_data);
    }
  }

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

  public long getDelay() {
    return this.delay;
  }

  public AdaptTestStruct setDelay(long delay) {
    this.delay = delay;
    setDelayIsSet(true);
    return this;
  }

  public void unsetDelay() {
    __isset_bit_vector.clear(__DELAY_ISSET_ID);
  }

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

  public void setDelayIsSet(boolean __value) {
    __isset_bit_vector.set(__DELAY_ISSET_ID, __value);
  }

  public byte[] getCustom() {
    return this.custom;
  }

  public AdaptTestStruct setCustom(byte[] custom) {
    this.custom = custom;
    return this;
  }

  public void unsetCustom() {
    this.custom = null;
  }

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

  public void setCustomIsSet(boolean __value) {
    if (!__value) {
      this.custom = null;
    }
  }

  public long getTimeout() {
    return this.timeout;
  }

  public AdaptTestStruct setTimeout(long timeout) {
    this.timeout = timeout;
    setTimeoutIsSet(true);
    return this;
  }

  public void unsetTimeout() {
    __isset_bit_vector.clear(__TIMEOUT_ISSET_ID);
  }

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

  public void setTimeoutIsSet(boolean __value) {
    __isset_bit_vector.set(__TIMEOUT_ISSET_ID, __value);
  }

  public long getData() {
    return this.data;
  }

  public AdaptTestStruct setData(long data) {
    this.data = data;
    setDataIsSet(true);
    return this;
  }

  public void unsetData() {
    __isset_bit_vector.clear(__DATA_ISSET_ID);
  }

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

  public void setDataIsSet(boolean __value) {
    __isset_bit_vector.set(__DATA_ISSET_ID, __value);
  }

  public String getMeta() {
    return this.meta;
  }

  public AdaptTestStruct setMeta(String meta) {
    this.meta = meta;
    return this;
  }

  public void unsetMeta() {
    this.meta = null;
  }

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

  public void setMetaIsSet(boolean __value) {
    if (!__value) {
      this.meta = null;
    }
  }

  public String getIndirectionString() {
    return this.indirectionString;
  }

  public AdaptTestStruct setIndirectionString(String indirectionString) {
    this.indirectionString = indirectionString;
    return this;
  }

  public void unsetIndirectionString() {
    this.indirectionString = null;
  }

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

  public void setIndirectionStringIsSet(boolean __value) {
    if (!__value) {
      this.indirectionString = null;
    }
  }

  public String getString_data() {
    return this.string_data;
  }

  public AdaptTestStruct setString_data(String string_data) {
    this.string_data = string_data;
    return this;
  }

  public void unsetString_data() {
    this.string_data = null;
  }

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

  public void setString_dataIsSet(boolean __value) {
    if (!__value) {
      this.string_data = null;
    }
  }

  public boolean isDouble_wrapped_bool() {
    return this.double_wrapped_bool;
  }

  public AdaptTestStruct setDouble_wrapped_bool(boolean double_wrapped_bool) {
    this.double_wrapped_bool = double_wrapped_bool;
    setDouble_wrapped_boolIsSet(true);
    return this;
  }

  public void unsetDouble_wrapped_bool() {
    __isset_bit_vector.clear(__DOUBLE_WRAPPED_BOOL_ISSET_ID);
  }

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

  public void setDouble_wrapped_boolIsSet(boolean __value) {
    __isset_bit_vector.set(__DOUBLE_WRAPPED_BOOL_ISSET_ID, __value);
  }

  public int getDouble_wrapped_integer() {
    return this.double_wrapped_integer;
  }

  public AdaptTestStruct setDouble_wrapped_integer(int double_wrapped_integer) {
    this.double_wrapped_integer = double_wrapped_integer;
    setDouble_wrapped_integerIsSet(true);
    return this;
  }

  public void unsetDouble_wrapped_integer() {
    __isset_bit_vector.clear(__DOUBLE_WRAPPED_INTEGER_ISSET_ID);
  }

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

  public void setDouble_wrapped_integerIsSet(boolean __value) {
    __isset_bit_vector.set(__DOUBLE_WRAPPED_INTEGER_ISSET_ID, __value);
  }

  public byte[] getBinary_data() {
    return this.binary_data;
  }

  public AdaptTestStruct setBinary_data(byte[] binary_data) {
    this.binary_data = binary_data;
    return this;
  }

  public void unsetBinary_data() {
    this.binary_data = null;
  }

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

  public void setBinary_dataIsSet(boolean __value) {
    if (!__value) {
      this.binary_data = null;
    }
  }

  public void setFieldValue(int fieldID, Object __value) {
    switch (fieldID) {
    case DELAY:
      if (__value == null) {
        unsetDelay();
      } else {
        setDelay((Long)__value);
      }
      break;

    case CUSTOM:
      if (__value == null) {
        unsetCustom();
      } else {
        setCustom((byte[])__value);
      }
      break;

    case TIMEOUT:
      if (__value == null) {
        unsetTimeout();
      } else {
        setTimeout((Long)__value);
      }
      break;

    case DATA:
      if (__value == null) {
        unsetData();
      } else {
        setData((Long)__value);
      }
      break;

    case META:
      if (__value == null) {
        unsetMeta();
      } else {
        setMeta((String)__value);
      }
      break;

    case INDIRECTIONSTRING:
      if (__value == null) {
        unsetIndirectionString();
      } else {
        setIndirectionString((String)__value);
      }
      break;

    case STRING_DATA:
      if (__value == null) {
        unsetString_data();
      } else {
        setString_data((String)__value);
      }
      break;

    case DOUBLE_WRAPPED_BOOL:
      if (__value == null) {
        unsetDouble_wrapped_bool();
      } else {
        setDouble_wrapped_bool((Boolean)__value);
      }
      break;

    case DOUBLE_WRAPPED_INTEGER:
      if (__value == null) {
        unsetDouble_wrapped_integer();
      } else {
        setDouble_wrapped_integer((Integer)__value);
      }
      break;

    case BINARY_DATA:
      if (__value == null) {
        unsetBinary_data();
      } else {
        setBinary_data((byte[])__value);
      }
      break;

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

  public Object getFieldValue(int fieldID) {
    switch (fieldID) {
    case DELAY:
      return new Long(getDelay());

    case CUSTOM:
      return getCustom();

    case TIMEOUT:
      return new Long(getTimeout());

    case DATA:
      return new Long(getData());

    case META:
      return getMeta();

    case INDIRECTIONSTRING:
      return getIndirectionString();

    case STRING_DATA:
      return getString_data();

    case DOUBLE_WRAPPED_BOOL:
      return new Boolean(isDouble_wrapped_bool());

    case DOUBLE_WRAPPED_INTEGER:
      return new Integer(getDouble_wrapped_integer());

    case BINARY_DATA:
      return getBinary_data();

    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 AdaptTestStruct))
      return false;
    AdaptTestStruct that = (AdaptTestStruct)_that;

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

    if (!TBaseHelper.equalsSlow(this.isSetCustom(), that.isSetCustom(), this.custom, that.custom)) { return false; }

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

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

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

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

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

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

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

    if (!TBaseHelper.equalsSlow(this.isSetBinary_data(), that.isSetBinary_data(), this.binary_data, that.binary_data)) { return false; }

    return true;
  }

  @Override
  public int hashCode() {
    return Arrays.deepHashCode(new Object[] {delay, custom, timeout, data, meta, indirectionString, string_data, double_wrapped_bool, double_wrapped_integer, binary_data});
  }

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

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

    lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(delay, other.delay);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetCustom()).compareTo(other.isSetCustom());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(custom, other.custom);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetTimeout()).compareTo(other.isSetTimeout());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(timeout, other.timeout);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetData()).compareTo(other.isSetData());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(data, other.data);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetMeta()).compareTo(other.isSetMeta());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(meta, other.meta);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetIndirectionString()).compareTo(other.isSetIndirectionString());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(indirectionString, other.indirectionString);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetString_data()).compareTo(other.isSetString_data());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(string_data, other.string_data);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetDouble_wrapped_bool()).compareTo(other.isSetDouble_wrapped_bool());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(double_wrapped_bool, other.double_wrapped_bool);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetDouble_wrapped_integer()).compareTo(other.isSetDouble_wrapped_integer());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(double_wrapped_integer, other.double_wrapped_integer);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetBinary_data()).compareTo(other.isSetBinary_data());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(binary_data, other.binary_data);
    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 DELAY:
          if (__field.type == TType.I64) {
            this.delay = iprot.readI64();
            setDelayIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case CUSTOM:
          if (__field.type == TType.STRING) {
            this.custom = iprot.readBinary();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case TIMEOUT:
          if (__field.type == TType.I64) {
            this.timeout = iprot.readI64();
            setTimeoutIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case DATA:
          if (__field.type == TType.I64) {
            this.data = iprot.readI64();
            setDataIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case META:
          if (__field.type == TType.STRING) {
            this.meta = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case INDIRECTIONSTRING:
          if (__field.type == TType.STRING) {
            this.indirectionString = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case STRING_DATA:
          if (__field.type == TType.STRING) {
            this.string_data = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case DOUBLE_WRAPPED_BOOL:
          if (__field.type == TType.BOOL) {
            this.double_wrapped_bool = iprot.readBool();
            setDouble_wrapped_boolIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case DOUBLE_WRAPPED_INTEGER:
          if (__field.type == TType.I32) {
            this.double_wrapped_integer = iprot.readI32();
            setDouble_wrapped_integerIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case BINARY_DATA:
          if (__field.type == TType.STRING) {
            this.binary_data = iprot.readBinary();
          } 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(DELAY_FIELD_DESC);
    oprot.writeI64(this.delay);
    oprot.writeFieldEnd();
    if (this.custom != null) {
      oprot.writeFieldBegin(CUSTOM_FIELD_DESC);
      oprot.writeBinary(this.custom);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(TIMEOUT_FIELD_DESC);
    oprot.writeI64(this.timeout);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(DATA_FIELD_DESC);
    oprot.writeI64(this.data);
    oprot.writeFieldEnd();
    if (this.meta != null) {
      oprot.writeFieldBegin(META_FIELD_DESC);
      oprot.writeString(this.meta);
      oprot.writeFieldEnd();
    }
    if (this.indirectionString != null) {
      oprot.writeFieldBegin(INDIRECTION_STRING_FIELD_DESC);
      oprot.writeString(this.indirectionString);
      oprot.writeFieldEnd();
    }
    if (this.string_data != null) {
      oprot.writeFieldBegin(STRING_DATA_FIELD_DESC);
      oprot.writeString(this.string_data);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(DOUBLE_WRAPPED_BOOL_FIELD_DESC);
    oprot.writeBool(this.double_wrapped_bool);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(DOUBLE_WRAPPED_INTEGER_FIELD_DESC);
    oprot.writeI32(this.double_wrapped_integer);
    oprot.writeFieldEnd();
    if (this.binary_data != null) {
      oprot.writeFieldBegin(BINARY_DATA_FIELD_DESC);
      oprot.writeBinary(this.binary_data);
      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("AdaptTestStruct");
    sb.append(space);
    sb.append("(");
    sb.append(newLine);
    boolean first = true;

    sb.append(indentStr);
    sb.append("delay");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getDelay(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("custom");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getCustom() == null) {
      sb.append("null");
    } else {
        int __custom_size = Math.min(this.getCustom().length, 128);
        for (int i = 0; i < __custom_size; i++) {
          if (i != 0) sb.append(" ");
          sb.append(Integer.toHexString(this.getCustom()[i]).length() > 1 ? Integer.toHexString(this.getCustom()[i]).substring(Integer.toHexString(this.getCustom()[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.getCustom()[i]).toUpperCase());
        }
        if (this.getCustom().length > 128) sb.append(" ...");
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("timeout");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getTimeout(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("data");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getData(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("meta");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getMeta() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getMeta(), indent + 1, prettyPrint));
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("indirectionString");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getIndirectionString() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getIndirectionString(), indent + 1, prettyPrint));
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("string_data");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getString_data() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getString_data(), indent + 1, prettyPrint));
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("double_wrapped_bool");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.isDouble_wrapped_bool(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("double_wrapped_integer");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getDouble_wrapped_integer(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("binary_data");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getBinary_data() == null) {
      sb.append("null");
    } else {
        int __binary_data_size = Math.min(this.getBinary_data().length, 128);
        for (int i = 0; i < __binary_data_size; i++) {
          if (i != 0) sb.append(" ");
          sb.append(Integer.toHexString(this.getBinary_data()[i]).length() > 1 ? Integer.toHexString(this.getBinary_data()[i]).substring(Integer.toHexString(this.getBinary_data()[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.getBinary_data()[i]).toUpperCase());
        }
        if (this.getBinary_data().length > 128) sb.append(" ...");
    }
    first = false;
    sb.append(newLine + TBaseHelper.reduceIndent(indentStr));
    sb.append(")");
    return sb.toString();
  }

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

}

