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

com.bendb.thrifty.test.gen.CrazyNesting Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.bendb.thrifty.test.gen;

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.3)", date = "2016-01-04")
public class CrazyNesting 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("CrazyNesting");

  private static final org.apache.thrift.protocol.TField STRING_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("string_field", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField SET_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("set_field", org.apache.thrift.protocol.TType.SET, (short)2);
  private static final org.apache.thrift.protocol.TField LIST_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("list_field", org.apache.thrift.protocol.TType.LIST, (short)3);
  private static final org.apache.thrift.protocol.TField BINARY_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("binary_field", org.apache.thrift.protocol.TType.STRING, (short)4);

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

  public String string_field; // required
  public Set set_field; // optional
  public List,Map>>>>> list_field; // required
  public ByteBuffer binary_field; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    STRING_FIELD((short)1, "string_field"),
    SET_FIELD((short)2, "set_field"),
    LIST_FIELD((short)3, "list_field"),
    BINARY_FIELD((short)4, "binary_field");

    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 1: // STRING_FIELD
          return STRING_FIELD;
        case 2: // SET_FIELD
          return SET_FIELD;
        case 3: // LIST_FIELD
          return LIST_FIELD;
        case 4: // BINARY_FIELD
          return BINARY_FIELD;
        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 _Fields optionals[] = {_Fields.SET_FIELD};
  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.STRING_FIELD, new org.apache.thrift.meta_data.FieldMetaData("string_field", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.SET_FIELD, new org.apache.thrift.meta_data.FieldMetaData("set_field", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Insanity.class))));
    tmpMap.put(_Fields.LIST_FIELD, new org.apache.thrift.meta_data.FieldMetaData("list_field", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
                new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
                    new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)), 
                new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
                    new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32), 
                    new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
                        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
                            new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
                                new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Insanity.class), 
                                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))))))));
    tmpMap.put(_Fields.BINARY_FIELD, new org.apache.thrift.meta_data.FieldMetaData("binary_field", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        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(CrazyNesting.class, metaDataMap);
  }

  public CrazyNesting() {
  }

  public CrazyNesting(
    String string_field,
    List,Map>>>>> list_field,
    ByteBuffer binary_field)
  {
    this();
    this.string_field = string_field;
    this.list_field = list_field;
    this.binary_field = org.apache.thrift.TBaseHelper.copyBinary(binary_field);
  }

  /**
   * Performs a deep copy on other.
   */
  public CrazyNesting(CrazyNesting other) {
    if (other.isSetString_field()) {
      this.string_field = other.string_field;
    }
    if (other.isSetSet_field()) {
      Set __this__set_field = new HashSet(other.set_field.size());
      for (Insanity other_element : other.set_field) {
        __this__set_field.add(new Insanity(other_element));
      }
      this.set_field = __this__set_field;
    }
    if (other.isSetList_field()) {
      List,Map>>>>> __this__list_field = new ArrayList,Map>>>>>(other.list_field.size());
      for (Map,Map>>>> other_element : other.list_field) {
        Map,Map>>>> __this__list_field_copy = new HashMap,Map>>>>(other_element.size());
        for (Map.Entry, Map>>>> other_element_element : other_element.entrySet()) {

          Set other_element_element_key = other_element_element.getKey();
          Map>>> other_element_element_value = other_element_element.getValue();

          Set __this__list_field_copy_copy_key = new HashSet(other_element_element_key);

          Map>>> __this__list_field_copy_copy_value = new HashMap>>>(other_element_element_value.size());
          for (Map.Entry>>> other_element_element_value_element : other_element_element_value.entrySet()) {

            Integer other_element_element_value_element_key = other_element_element_value_element.getKey();
            Set>> other_element_element_value_element_value = other_element_element_value_element.getValue();

            Integer __this__list_field_copy_copy_value_copy_key = other_element_element_value_element_key;

            Set>> __this__list_field_copy_copy_value_copy_value = new HashSet>>(other_element_element_value_element_value.size());
            for (List> other_element_element_value_element_value_element : other_element_element_value_element_value) {
              List> __this__list_field_copy_copy_value_copy_value_copy = new ArrayList>(other_element_element_value_element_value_element.size());
              for (Map other_element_element_value_element_value_element_element : other_element_element_value_element_value_element) {
                Map __this__list_field_copy_copy_value_copy_value_copy_copy = new HashMap(other_element_element_value_element_value_element_element.size());
                for (Map.Entry other_element_element_value_element_value_element_element_element : other_element_element_value_element_value_element_element.entrySet()) {

                  Insanity other_element_element_value_element_value_element_element_element_key = other_element_element_value_element_value_element_element_element.getKey();
                  String other_element_element_value_element_value_element_element_element_value = other_element_element_value_element_value_element_element_element.getValue();

                  Insanity __this__list_field_copy_copy_value_copy_value_copy_copy_copy_key = new Insanity(other_element_element_value_element_value_element_element_element_key);

                  String __this__list_field_copy_copy_value_copy_value_copy_copy_copy_value = other_element_element_value_element_value_element_element_element_value;

                  __this__list_field_copy_copy_value_copy_value_copy_copy.put(__this__list_field_copy_copy_value_copy_value_copy_copy_copy_key, __this__list_field_copy_copy_value_copy_value_copy_copy_copy_value);
                }
                __this__list_field_copy_copy_value_copy_value_copy.add(__this__list_field_copy_copy_value_copy_value_copy_copy);
              }
              __this__list_field_copy_copy_value_copy_value.add(__this__list_field_copy_copy_value_copy_value_copy);
            }

            __this__list_field_copy_copy_value.put(__this__list_field_copy_copy_value_copy_key, __this__list_field_copy_copy_value_copy_value);
          }

          __this__list_field_copy.put(__this__list_field_copy_copy_key, __this__list_field_copy_copy_value);
        }
        __this__list_field.add(__this__list_field_copy);
      }
      this.list_field = __this__list_field;
    }
    if (other.isSetBinary_field()) {
      this.binary_field = org.apache.thrift.TBaseHelper.copyBinary(other.binary_field);
    }
  }

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

  @Override
  public void clear() {
    this.string_field = null;
    this.set_field = null;
    this.list_field = null;
    this.binary_field = null;
  }

  public String getString_field() {
    return this.string_field;
  }

  public CrazyNesting setString_field(String string_field) {
    this.string_field = string_field;
    return this;
  }

  public void unsetString_field() {
    this.string_field = null;
  }

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

  public void setString_fieldIsSet(boolean value) {
    if (!value) {
      this.string_field = null;
    }
  }

  public int getSet_fieldSize() {
    return (this.set_field == null) ? 0 : this.set_field.size();
  }

  public java.util.Iterator getSet_fieldIterator() {
    return (this.set_field == null) ? null : this.set_field.iterator();
  }

  public void addToSet_field(Insanity elem) {
    if (this.set_field == null) {
      this.set_field = new HashSet();
    }
    this.set_field.add(elem);
  }

  public Set getSet_field() {
    return this.set_field;
  }

  public CrazyNesting setSet_field(Set set_field) {
    this.set_field = set_field;
    return this;
  }

  public void unsetSet_field() {
    this.set_field = null;
  }

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

  public void setSet_fieldIsSet(boolean value) {
    if (!value) {
      this.set_field = null;
    }
  }

  public int getList_fieldSize() {
    return (this.list_field == null) ? 0 : this.list_field.size();
  }

  public java.util.Iterator,Map>>>>> getList_fieldIterator() {
    return (this.list_field == null) ? null : this.list_field.iterator();
  }

  public void addToList_field(Map,Map>>>> elem) {
    if (this.list_field == null) {
      this.list_field = new ArrayList,Map>>>>>();
    }
    this.list_field.add(elem);
  }

  public List,Map>>>>> getList_field() {
    return this.list_field;
  }

  public CrazyNesting setList_field(List,Map>>>>> list_field) {
    this.list_field = list_field;
    return this;
  }

  public void unsetList_field() {
    this.list_field = null;
  }

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

  public void setList_fieldIsSet(boolean value) {
    if (!value) {
      this.list_field = null;
    }
  }

  public byte[] getBinary_field() {
    setBinary_field(org.apache.thrift.TBaseHelper.rightSize(binary_field));
    return binary_field == null ? null : binary_field.array();
  }

  public ByteBuffer bufferForBinary_field() {
    return org.apache.thrift.TBaseHelper.copyBinary(binary_field);
  }

  public CrazyNesting setBinary_field(byte[] binary_field) {
    this.binary_field = binary_field == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(binary_field, binary_field.length));
    return this;
  }

  public CrazyNesting setBinary_field(ByteBuffer binary_field) {
    this.binary_field = org.apache.thrift.TBaseHelper.copyBinary(binary_field);
    return this;
  }

  public void unsetBinary_field() {
    this.binary_field = null;
  }

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

  public void setBinary_fieldIsSet(boolean value) {
    if (!value) {
      this.binary_field = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case STRING_FIELD:
      if (value == null) {
        unsetString_field();
      } else {
        setString_field((String)value);
      }
      break;

    case SET_FIELD:
      if (value == null) {
        unsetSet_field();
      } else {
        setSet_field((Set)value);
      }
      break;

    case LIST_FIELD:
      if (value == null) {
        unsetList_field();
      } else {
        setList_field((List,Map>>>>>)value);
      }
      break;

    case BINARY_FIELD:
      if (value == null) {
        unsetBinary_field();
      } else {
        setBinary_field((ByteBuffer)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case STRING_FIELD:
      return getString_field();

    case SET_FIELD:
      return getSet_field();

    case LIST_FIELD:
      return getList_field();

    case BINARY_FIELD:
      return getBinary_field();

    }
    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 STRING_FIELD:
      return isSetString_field();
    case SET_FIELD:
      return isSetSet_field();
    case LIST_FIELD:
      return isSetList_field();
    case BINARY_FIELD:
      return isSetBinary_field();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_string_field = true && this.isSetString_field();
    boolean that_present_string_field = true && that.isSetString_field();
    if (this_present_string_field || that_present_string_field) {
      if (!(this_present_string_field && that_present_string_field))
        return false;
      if (!this.string_field.equals(that.string_field))
        return false;
    }

    boolean this_present_set_field = true && this.isSetSet_field();
    boolean that_present_set_field = true && that.isSetSet_field();
    if (this_present_set_field || that_present_set_field) {
      if (!(this_present_set_field && that_present_set_field))
        return false;
      if (!this.set_field.equals(that.set_field))
        return false;
    }

    boolean this_present_list_field = true && this.isSetList_field();
    boolean that_present_list_field = true && that.isSetList_field();
    if (this_present_list_field || that_present_list_field) {
      if (!(this_present_list_field && that_present_list_field))
        return false;
      if (!this.list_field.equals(that.list_field))
        return false;
    }

    boolean this_present_binary_field = true && this.isSetBinary_field();
    boolean that_present_binary_field = true && that.isSetBinary_field();
    if (this_present_binary_field || that_present_binary_field) {
      if (!(this_present_binary_field && that_present_binary_field))
        return false;
      if (!this.binary_field.equals(that.binary_field))
        return false;
    }

    return true;
  }

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

    boolean present_string_field = true && (isSetString_field());
    list.add(present_string_field);
    if (present_string_field)
      list.add(string_field);

    boolean present_set_field = true && (isSetSet_field());
    list.add(present_set_field);
    if (present_set_field)
      list.add(set_field);

    boolean present_list_field = true && (isSetList_field());
    list.add(present_list_field);
    if (present_list_field)
      list.add(list_field);

    boolean present_binary_field = true && (isSetBinary_field());
    list.add(present_binary_field);
    if (present_binary_field)
      list.add(binary_field);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetString_field()).compareTo(other.isSetString_field());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetString_field()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.string_field, other.string_field);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSet_field()).compareTo(other.isSetSet_field());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSet_field()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.set_field, other.set_field);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetList_field()).compareTo(other.isSetList_field());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetList_field()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.list_field, other.list_field);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBinary_field()).compareTo(other.isSetBinary_field());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBinary_field()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.binary_field, other.binary_field);
      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("CrazyNesting(");
    boolean first = true;

    sb.append("string_field:");
    if (this.string_field == null) {
      sb.append("null");
    } else {
      sb.append(this.string_field);
    }
    first = false;
    if (isSetSet_field()) {
      if (!first) sb.append(", ");
      sb.append("set_field:");
      if (this.set_field == null) {
        sb.append("null");
      } else {
        sb.append(this.set_field);
      }
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("list_field:");
    if (this.list_field == null) {
      sb.append("null");
    } else {
      sb.append(this.list_field);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("binary_field:");
    if (this.binary_field == null) {
      sb.append("null");
    } else {
      org.apache.thrift.TBaseHelper.toString(this.binary_field, sb);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (list_field == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'list_field' was not present! Struct: " + toString());
    }
    // 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 {
      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 CrazyNestingStandardSchemeFactory implements SchemeFactory {
    public CrazyNestingStandardScheme getScheme() {
      return new CrazyNestingStandardScheme();
    }
  }

  private static class CrazyNestingStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, CrazyNesting 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 1: // STRING_FIELD
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.string_field = iprot.readString();
              struct.setString_fieldIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // SET_FIELD
            if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
              {
                org.apache.thrift.protocol.TSet _set18 = iprot.readSetBegin();
                struct.set_field = new HashSet(2*_set18.size);
                Insanity _elem19;
                for (int _i20 = 0; _i20 < _set18.size; ++_i20)
                {
                  _elem19 = new Insanity();
                  _elem19.read(iprot);
                  struct.set_field.add(_elem19);
                }
                iprot.readSetEnd();
              }
              struct.setSet_fieldIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // LIST_FIELD
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list21 = iprot.readListBegin();
                struct.list_field = new ArrayList,Map>>>>>(_list21.size);
                Map,Map>>>> _elem22;
                for (int _i23 = 0; _i23 < _list21.size; ++_i23)
                {
                  {
                    org.apache.thrift.protocol.TMap _map24 = iprot.readMapBegin();
                    _elem22 = new HashMap,Map>>>>(2*_map24.size);
                    Set _key25;
                    Map>>> _val26;
                    for (int _i27 = 0; _i27 < _map24.size; ++_i27)
                    {
                      {
                        org.apache.thrift.protocol.TSet _set28 = iprot.readSetBegin();
                        _key25 = new HashSet(2*_set28.size);
                        int _elem29;
                        for (int _i30 = 0; _i30 < _set28.size; ++_i30)
                        {
                          _elem29 = iprot.readI32();
                          _key25.add(_elem29);
                        }
                        iprot.readSetEnd();
                      }
                      {
                        org.apache.thrift.protocol.TMap _map31 = iprot.readMapBegin();
                        _val26 = new HashMap>>>(2*_map31.size);
                        int _key32;
                        Set>> _val33;
                        for (int _i34 = 0; _i34 < _map31.size; ++_i34)
                        {
                          _key32 = iprot.readI32();
                          {
                            org.apache.thrift.protocol.TSet _set35 = iprot.readSetBegin();
                            _val33 = new HashSet>>(2*_set35.size);
                            List> _elem36;
                            for (int _i37 = 0; _i37 < _set35.size; ++_i37)
                            {
                              {
                                org.apache.thrift.protocol.TList _list38 = iprot.readListBegin();
                                _elem36 = new ArrayList>(_list38.size);
                                Map _elem39;
                                for (int _i40 = 0; _i40 < _list38.size; ++_i40)
                                {
                                  {
                                    org.apache.thrift.protocol.TMap _map41 = iprot.readMapBegin();
                                    _elem39 = new HashMap(2*_map41.size);
                                    Insanity _key42;
                                    String _val43;
                                    for (int _i44 = 0; _i44 < _map41.size; ++_i44)
                                    {
                                      _key42 = new Insanity();
                                      _key42.read(iprot);
                                      _val43 = iprot.readString();
                                      _elem39.put(_key42, _val43);
                                    }
                                    iprot.readMapEnd();
                                  }
                                  _elem36.add(_elem39);
                                }
                                iprot.readListEnd();
                              }
                              _val33.add(_elem36);
                            }
                            iprot.readSetEnd();
                          }
                          _val26.put(_key32, _val33);
                        }
                        iprot.readMapEnd();
                      }
                      _elem22.put(_key25, _val26);
                    }
                    iprot.readMapEnd();
                  }
                  struct.list_field.add(_elem22);
                }
                iprot.readListEnd();
              }
              struct.setList_fieldIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // BINARY_FIELD
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.binary_field = iprot.readBinary();
              struct.setBinary_fieldIsSet(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, CrazyNesting struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.string_field != null) {
        oprot.writeFieldBegin(STRING_FIELD_FIELD_DESC);
        oprot.writeString(struct.string_field);
        oprot.writeFieldEnd();
      }
      if (struct.set_field != null) {
        if (struct.isSetSet_field()) {
          oprot.writeFieldBegin(SET_FIELD_FIELD_DESC);
          {
            oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.set_field.size()));
            for (Insanity _iter45 : struct.set_field)
            {
              _iter45.write(oprot);
            }
            oprot.writeSetEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.list_field != null) {
        oprot.writeFieldBegin(LIST_FIELD_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.MAP, struct.list_field.size()));
          for (Map,Map>>>> _iter46 : struct.list_field)
          {
            {
              oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.SET, org.apache.thrift.protocol.TType.MAP, _iter46.size()));
              for (Map.Entry, Map>>>> _iter47 : _iter46.entrySet())
              {
                {
                  oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I32, _iter47.getKey().size()));
                  for (int _iter48 : _iter47.getKey())
                  {
                    oprot.writeI32(_iter48);
                  }
                  oprot.writeSetEnd();
                }
                {
                  oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.SET, _iter47.getValue().size()));
                  for (Map.Entry>>> _iter49 : _iter47.getValue().entrySet())
                  {
                    oprot.writeI32(_iter49.getKey());
                    {
                      oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.LIST, _iter49.getValue().size()));
                      for (List> _iter50 : _iter49.getValue())
                      {
                        {
                          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.MAP, _iter50.size()));
                          for (Map _iter51 : _iter50)
                          {
                            {
                              oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRUCT, org.apache.thrift.protocol.TType.STRING, _iter51.size()));
                              for (Map.Entry _iter52 : _iter51.entrySet())
                              {
                                _iter52.getKey().write(oprot);
                                oprot.writeString(_iter52.getValue());
                              }
                              oprot.writeMapEnd();
                            }
                          }
                          oprot.writeListEnd();
                        }
                      }
                      oprot.writeSetEnd();
                    }
                  }
                  oprot.writeMapEnd();
                }
              }
              oprot.writeMapEnd();
            }
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.binary_field != null) {
        oprot.writeFieldBegin(BINARY_FIELD_FIELD_DESC);
        oprot.writeBinary(struct.binary_field);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class CrazyNestingTupleSchemeFactory implements SchemeFactory {
    public CrazyNestingTupleScheme getScheme() {
      return new CrazyNestingTupleScheme();
    }
  }

  private static class CrazyNestingTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, CrazyNesting struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      {
        oprot.writeI32(struct.list_field.size());
        for (Map,Map>>>> _iter53 : struct.list_field)
        {
          {
            oprot.writeI32(_iter53.size());
            for (Map.Entry, Map>>>> _iter54 : _iter53.entrySet())
            {
              {
                oprot.writeI32(_iter54.getKey().size());
                for (int _iter55 : _iter54.getKey())
                {
                  oprot.writeI32(_iter55);
                }
              }
              {
                oprot.writeI32(_iter54.getValue().size());
                for (Map.Entry>>> _iter56 : _iter54.getValue().entrySet())
                {
                  oprot.writeI32(_iter56.getKey());
                  {
                    oprot.writeI32(_iter56.getValue().size());
                    for (List> _iter57 : _iter56.getValue())
                    {
                      {
                        oprot.writeI32(_iter57.size());
                        for (Map _iter58 : _iter57)
                        {
                          {
                            oprot.writeI32(_iter58.size());
                            for (Map.Entry _iter59 : _iter58.entrySet())
                            {
                              _iter59.getKey().write(oprot);
                              oprot.writeString(_iter59.getValue());
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      BitSet optionals = new BitSet();
      if (struct.isSetString_field()) {
        optionals.set(0);
      }
      if (struct.isSetSet_field()) {
        optionals.set(1);
      }
      if (struct.isSetBinary_field()) {
        optionals.set(2);
      }
      oprot.writeBitSet(optionals, 3);
      if (struct.isSetString_field()) {
        oprot.writeString(struct.string_field);
      }
      if (struct.isSetSet_field()) {
        {
          oprot.writeI32(struct.set_field.size());
          for (Insanity _iter60 : struct.set_field)
          {
            _iter60.write(oprot);
          }
        }
      }
      if (struct.isSetBinary_field()) {
        oprot.writeBinary(struct.binary_field);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, CrazyNesting struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      {
        org.apache.thrift.protocol.TList _list61 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.MAP, iprot.readI32());
        struct.list_field = new ArrayList,Map>>>>>(_list61.size);
        Map,Map>>>> _elem62;
        for (int _i63 = 0; _i63 < _list61.size; ++_i63)
        {
          {
            org.apache.thrift.protocol.TMap _map64 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.SET, org.apache.thrift.protocol.TType.MAP, iprot.readI32());
            _elem62 = new HashMap,Map>>>>(2*_map64.size);
            Set _key65;
            Map>>> _val66;
            for (int _i67 = 0; _i67 < _map64.size; ++_i67)
            {
              {
                org.apache.thrift.protocol.TSet _set68 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I32, iprot.readI32());
                _key65 = new HashSet(2*_set68.size);
                int _elem69;
                for (int _i70 = 0; _i70 < _set68.size; ++_i70)
                {
                  _elem69 = iprot.readI32();
                  _key65.add(_elem69);
                }
              }
              {
                org.apache.thrift.protocol.TMap _map71 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.SET, iprot.readI32());
                _val66 = new HashMap>>>(2*_map71.size);
                int _key72;
                Set>> _val73;
                for (int _i74 = 0; _i74 < _map71.size; ++_i74)
                {
                  _key72 = iprot.readI32();
                  {
                    org.apache.thrift.protocol.TSet _set75 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.LIST, iprot.readI32());
                    _val73 = new HashSet>>(2*_set75.size);
                    List> _elem76;
                    for (int _i77 = 0; _i77 < _set75.size; ++_i77)
                    {
                      {
                        org.apache.thrift.protocol.TList _list78 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.MAP, iprot.readI32());
                        _elem76 = new ArrayList>(_list78.size);
                        Map _elem79;
                        for (int _i80 = 0; _i80 < _list78.size; ++_i80)
                        {
                          {
                            org.apache.thrift.protocol.TMap _map81 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRUCT, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
                            _elem79 = new HashMap(2*_map81.size);
                            Insanity _key82;
                            String _val83;
                            for (int _i84 = 0; _i84 < _map81.size; ++_i84)
                            {
                              _key82 = new Insanity();
                              _key82.read(iprot);
                              _val83 = iprot.readString();
                              _elem79.put(_key82, _val83);
                            }
                          }
                          _elem76.add(_elem79);
                        }
                      }
                      _val73.add(_elem76);
                    }
                  }
                  _val66.put(_key72, _val73);
                }
              }
              _elem62.put(_key65, _val66);
            }
          }
          struct.list_field.add(_elem62);
        }
      }
      struct.setList_fieldIsSet(true);
      BitSet incoming = iprot.readBitSet(3);
      if (incoming.get(0)) {
        struct.string_field = iprot.readString();
        struct.setString_fieldIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TSet _set85 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.set_field = new HashSet(2*_set85.size);
          Insanity _elem86;
          for (int _i87 = 0; _i87 < _set85.size; ++_i87)
          {
            _elem86 = new Insanity();
            _elem86.read(iprot);
            struct.set_field.add(_elem86);
          }
        }
        struct.setSet_fieldIsSet(true);
      }
      if (incoming.get(2)) {
        struct.binary_field = iprot.readBinary();
        struct.setBinary_fieldIsSet(true);
      }
    }
  }

}