/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.facebook.thrift.annotation_deprecated;

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.*;

/**
 * Indicates additional backward compatibility restrictions, beyond the
 * standard Thrift required 'wire' compatibility.
 */
@SuppressWarnings({ "unused", "serial" })
public class RequiresBackwardCompatibility implements TBase, java.io.Serializable, Cloneable, Comparable<RequiresBackwardCompatibility> {
  private static final TStruct STRUCT_DESC = new TStruct("RequiresBackwardCompatibility");
  private static final TField FIELD_NAME_FIELD_DESC = new TField("field_name", TType.BOOL, (short)1);

  public boolean field_name;
  public static final int FIELD_NAME = 1;

  // isset id assignments
  private static final int __FIELD_NAME_ISSET_ID = 0;
  private BitSet __isset_bit_vector = new BitSet(1);

  public static final Map<Integer, FieldMetaData> metaDataMap;

  static {
    Map<Integer, FieldMetaData> tmpMetaDataMap = new HashMap<Integer, FieldMetaData>();
    tmpMetaDataMap.put(FIELD_NAME, new FieldMetaData("field_name", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.BOOL)));
    metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap);
  }

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

  public RequiresBackwardCompatibility() {
    this.field_name = false;

  }

  public RequiresBackwardCompatibility(
      boolean field_name) {
    this();
    this.field_name = field_name;
    setField_nameIsSet(true);
  }

  public static class Builder {
    private boolean field_name;

    BitSet __optional_isset = new BitSet(1);

    public Builder() {
    }

    public Builder setField_name(final boolean field_name) {
      this.field_name = field_name;
      __optional_isset.set(__FIELD_NAME_ISSET_ID, true);
      return this;
    }

    public RequiresBackwardCompatibility build() {
      RequiresBackwardCompatibility result = new RequiresBackwardCompatibility();
      if (__optional_isset.get(__FIELD_NAME_ISSET_ID)) {
        result.setField_name(this.field_name);
      }
      return result;
    }
  }

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

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public RequiresBackwardCompatibility(RequiresBackwardCompatibility other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.field_name = TBaseHelper.deepCopy(other.field_name);
  }

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

  public boolean isField_name() {
    return this.field_name;
  }

  public RequiresBackwardCompatibility setField_name(boolean field_name) {
    this.field_name = field_name;
    setField_nameIsSet(true);
    return this;
  }

  public void unsetField_name() {
    __isset_bit_vector.clear(__FIELD_NAME_ISSET_ID);
  }

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

  public void setField_nameIsSet(boolean __value) {
    __isset_bit_vector.set(__FIELD_NAME_ISSET_ID, __value);
  }

  public void setFieldValue(int fieldID, Object __value) {
    switch (fieldID) {
    case FIELD_NAME:
      if (__value == null) {
        unsetField_name();
      } else {
        setField_name((Boolean)__value);
      }
      break;

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

  public Object getFieldValue(int fieldID) {
    switch (fieldID) {
    case FIELD_NAME:
      return new Boolean(isField_name());

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

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

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetField_name()).compareTo(other.isSetField_name());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(field_name, other.field_name);
    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 FIELD_NAME:
          if (__field.type == TType.BOOL) {
            this.field_name = iprot.readBool();
            setField_nameIsSet(true);
          } 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(FIELD_NAME_FIELD_DESC);
    oprot.writeBool(this.field_name);
    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("RequiresBackwardCompatibility");
    sb.append(space);
    sb.append("(");
    sb.append(newLine);
    boolean first = true;

    sb.append(indentStr);
    sb.append("field_name");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.isField_name(), 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
  }

}

