/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
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 Serious extends Exception implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("Serious");
  private static final TField SONNET_FIELD_DESC = new TField("sonnet", TType.STRING, (short)1);

  public String sonnet;
  public static final int SONNET = 1;

  // isset id assignments

  public static final Map<Integer, FieldMetaData> metaDataMap;

  static {
    Map<Integer, FieldMetaData> tmpMetaDataMap = new HashMap<Integer, FieldMetaData>();
    tmpMetaDataMap.put(SONNET, new FieldMetaData("sonnet", TFieldRequirementType.OPTIONAL, 
        new FieldValueMetaData(TType.STRING)));
    metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap);
  }

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

  public Serious() {
  }

  public Serious(
      String sonnet) {
    this();
    this.sonnet = sonnet;
  }

  public static class Builder {
    private String sonnet;

    public Builder() {
    }

    public Builder setSonnet(final String sonnet) {
      this.sonnet = sonnet;
      return this;
    }

    public Serious build() {
      Serious result = new Serious();
      result.setSonnet(this.sonnet);
      return result;
    }
  }

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

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public Serious(Serious other) {
    if (other.isSetSonnet()) {
      this.sonnet = TBaseHelper.deepCopy(other.sonnet);
    }
  }

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

  public String getSonnet() {
    return this.sonnet;
  }

  public Serious setSonnet(String sonnet) {
    this.sonnet = sonnet;
    return this;
  }

  public void unsetSonnet() {
    this.sonnet = null;
  }

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

  public void setSonnetIsSet(boolean __value) {
    if (!__value) {
      this.sonnet = null;
    }
  }

  public void setFieldValue(int fieldID, Object __value) {
    switch (fieldID) {
    case SONNET:
      if (__value == null) {
        unsetSonnet();
      } else {
        setSonnet((String)__value);
      }
      break;

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

  public Object getFieldValue(int fieldID) {
    switch (fieldID) {
    case SONNET:
      return getSonnet();

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

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

    return true;
  }

  @Override
  public int hashCode() {
    return Arrays.deepHashCode(new Object[] {sonnet});
  }

  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 SONNET:
          if (__field.type == TType.STRING) {
            this.sonnet = 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);
    if (this.sonnet != null) {
      if (isSetSonnet()) {
        oprot.writeFieldBegin(SONNET_FIELD_DESC);
        oprot.writeString(this.sonnet);
        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("Serious");
    sb.append(space);
    sb.append("(");
    sb.append(newLine);
    boolean first = true;

    if (isSetSonnet())
    {
      sb.append(indentStr);
      sb.append("sonnet");
      sb.append(space);
      sb.append(":").append(space);
      if (this.getSonnet() == null) {
        sb.append("null");
      } else {
        sb.append(TBaseHelper.toString(this.getSonnet(), 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
  }

}

