public void write(org.apache.thrift.protocol.TProtocol oprot, JSONField struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.string_val != null) {
        if (struct.isSetString_val()) {
          oprot.writeFieldBegin(STRING_VAL_FIELD_DESC);
          oprot.writeString(struct.string_val);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetBool_val()) {
        oprot.writeFieldBegin(BOOL_VAL_FIELD_DESC);
        oprot.writeBool(struct.bool_val);
        oprot.writeFieldEnd();
      }
      if (struct.isSetI32_val()) {
        oprot.writeFieldBegin(I32_VAL_FIELD_DESC);
        oprot.writeI32(struct.i32_val);
        oprot.writeFieldEnd();
      }
      if (struct.isSetI64_val()) {
        oprot.writeFieldBegin(I64_VAL_FIELD_DESC);
        oprot.writeI64(struct.i64_val);
        oprot.writeFieldEnd();
      }
      if (struct.isSetDouble_val()) {
        oprot.writeFieldBegin(DOUBLE_VAL_FIELD_DESC);
        oprot.writeDouble(struct.double_val);
        oprot.writeFieldEnd();
      }
      if (struct.isSetNull_val()) {
        oprot.writeFieldBegin(NULL_VAL_FIELD_DESC);
        oprot.writeBool(struct.null_val);
        oprot.writeFieldEnd();
      }
      if (struct.isSetRef_val()) {
        oprot.writeFieldBegin(REF_VAL_FIELD_DESC);
        oprot.writeI32(struct.ref_val);
        oprot.writeFieldEnd();
      }
      if (struct.array_val != null) {
        if (struct.isSetArray_val()) {
          oprot.writeFieldBegin(ARRAY_VAL_FIELD_DESC);
          {
            oprot.writeListBegin(
                new org.apache.thrift.protocol.TList(
                    org.apache.thrift.protocol.TType.I32, struct.array_val.size()));
            for (int _iter115 : struct.array_val) {
              oprot.writeI32(_iter115);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
 /** Performs a deep copy on <i>other</i>. */
 public JSONField(JSONField other) {
   __isset_bitfield = other.__isset_bitfield;
   if (other.isSetString_val()) {
     this.string_val = other.string_val;
   }
   this.bool_val = other.bool_val;
   this.i32_val = other.i32_val;
   this.i64_val = other.i64_val;
   this.double_val = other.double_val;
   this.null_val = other.null_val;
   this.ref_val = other.ref_val;
   if (other.isSetArray_val()) {
     List<Integer> __this__array_val = new ArrayList<Integer>(other.array_val);
     this.array_val = __this__array_val;
   }
 }
    public void read(org.apache.thrift.protocol.TProtocol iprot, JSONField 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_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.string_val = iprot.readString();
              struct.setString_valIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // BOOL_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.bool_val = iprot.readBool();
              struct.setBool_valIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // I32_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.i32_val = iprot.readI32();
              struct.setI32_valIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // I64_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.i64_val = iprot.readI64();
              struct.setI64_valIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // DOUBLE_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.double_val = iprot.readDouble();
              struct.setDouble_valIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // NULL_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.null_val = iprot.readBool();
              struct.setNull_valIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // REF_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.ref_val = iprot.readI32();
              struct.setRef_valIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // ARRAY_VAL
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list112 = iprot.readListBegin();
                struct.array_val = new ArrayList<Integer>(_list112.size);
                for (int _i113 = 0; _i113 < _list112.size; ++_i113) {
                  int _elem114;
                  _elem114 = iprot.readI32();
                  struct.array_val.add(_elem114);
                }
                iprot.readListEnd();
              }
              struct.setArray_valIsSet(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();
    }
  @Override
  public int compareTo(JSONField other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetString_val()).compareTo(other.isSetString_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetString_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.string_val, other.string_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBool_val()).compareTo(other.isSetBool_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBool_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bool_val, other.bool_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetI32_val()).compareTo(other.isSetI32_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetI32_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.i32_val, other.i32_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetI64_val()).compareTo(other.isSetI64_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetI64_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.i64_val, other.i64_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDouble_val()).compareTo(other.isSetDouble_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDouble_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.double_val, other.double_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNull_val()).compareTo(other.isSetNull_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNull_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.null_val, other.null_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRef_val()).compareTo(other.isSetRef_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRef_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ref_val, other.ref_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetArray_val()).compareTo(other.isSetArray_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetArray_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.array_val, other.array_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
  public boolean equals(JSONField that) {
    if (that == null) return false;

    boolean this_present_string_val = true && this.isSetString_val();
    boolean that_present_string_val = true && that.isSetString_val();
    if (this_present_string_val || that_present_string_val) {
      if (!(this_present_string_val && that_present_string_val)) return false;
      if (!this.string_val.equals(that.string_val)) return false;
    }

    boolean this_present_bool_val = true && this.isSetBool_val();
    boolean that_present_bool_val = true && that.isSetBool_val();
    if (this_present_bool_val || that_present_bool_val) {
      if (!(this_present_bool_val && that_present_bool_val)) return false;
      if (this.bool_val != that.bool_val) return false;
    }

    boolean this_present_i32_val = true && this.isSetI32_val();
    boolean that_present_i32_val = true && that.isSetI32_val();
    if (this_present_i32_val || that_present_i32_val) {
      if (!(this_present_i32_val && that_present_i32_val)) return false;
      if (this.i32_val != that.i32_val) return false;
    }

    boolean this_present_i64_val = true && this.isSetI64_val();
    boolean that_present_i64_val = true && that.isSetI64_val();
    if (this_present_i64_val || that_present_i64_val) {
      if (!(this_present_i64_val && that_present_i64_val)) return false;
      if (this.i64_val != that.i64_val) return false;
    }

    boolean this_present_double_val = true && this.isSetDouble_val();
    boolean that_present_double_val = true && that.isSetDouble_val();
    if (this_present_double_val || that_present_double_val) {
      if (!(this_present_double_val && that_present_double_val)) return false;
      if (this.double_val != that.double_val) return false;
    }

    boolean this_present_null_val = true && this.isSetNull_val();
    boolean that_present_null_val = true && that.isSetNull_val();
    if (this_present_null_val || that_present_null_val) {
      if (!(this_present_null_val && that_present_null_val)) return false;
      if (this.null_val != that.null_val) return false;
    }

    boolean this_present_ref_val = true && this.isSetRef_val();
    boolean that_present_ref_val = true && that.isSetRef_val();
    if (this_present_ref_val || that_present_ref_val) {
      if (!(this_present_ref_val && that_present_ref_val)) return false;
      if (this.ref_val != that.ref_val) return false;
    }

    boolean this_present_array_val = true && this.isSetArray_val();
    boolean that_present_array_val = true && that.isSetArray_val();
    if (this_present_array_val || that_present_array_val) {
      if (!(this_present_array_val && that_present_array_val)) return false;
      if (!this.array_val.equals(that.array_val)) return false;
    }

    return true;
  }
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, JSONField struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(8);
   if (incoming.get(0)) {
     struct.string_val = iprot.readString();
     struct.setString_valIsSet(true);
   }
   if (incoming.get(1)) {
     struct.bool_val = iprot.readBool();
     struct.setBool_valIsSet(true);
   }
   if (incoming.get(2)) {
     struct.i32_val = iprot.readI32();
     struct.setI32_valIsSet(true);
   }
   if (incoming.get(3)) {
     struct.i64_val = iprot.readI64();
     struct.setI64_valIsSet(true);
   }
   if (incoming.get(4)) {
     struct.double_val = iprot.readDouble();
     struct.setDouble_valIsSet(true);
   }
   if (incoming.get(5)) {
     struct.null_val = iprot.readBool();
     struct.setNull_valIsSet(true);
   }
   if (incoming.get(6)) {
     struct.ref_val = iprot.readI32();
     struct.setRef_valIsSet(true);
   }
   if (incoming.get(7)) {
     {
       org.apache.thrift.protocol.TList _list117 =
           new org.apache.thrift.protocol.TList(
               org.apache.thrift.protocol.TType.I32, iprot.readI32());
       struct.array_val = new ArrayList<Integer>(_list117.size);
       for (int _i118 = 0; _i118 < _list117.size; ++_i118) {
         int _elem119;
         _elem119 = iprot.readI32();
         struct.array_val.add(_elem119);
       }
     }
     struct.setArray_valIsSet(true);
   }
 }
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, JSONField struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetString_val()) {
     optionals.set(0);
   }
   if (struct.isSetBool_val()) {
     optionals.set(1);
   }
   if (struct.isSetI32_val()) {
     optionals.set(2);
   }
   if (struct.isSetI64_val()) {
     optionals.set(3);
   }
   if (struct.isSetDouble_val()) {
     optionals.set(4);
   }
   if (struct.isSetNull_val()) {
     optionals.set(5);
   }
   if (struct.isSetRef_val()) {
     optionals.set(6);
   }
   if (struct.isSetArray_val()) {
     optionals.set(7);
   }
   oprot.writeBitSet(optionals, 8);
   if (struct.isSetString_val()) {
     oprot.writeString(struct.string_val);
   }
   if (struct.isSetBool_val()) {
     oprot.writeBool(struct.bool_val);
   }
   if (struct.isSetI32_val()) {
     oprot.writeI32(struct.i32_val);
   }
   if (struct.isSetI64_val()) {
     oprot.writeI64(struct.i64_val);
   }
   if (struct.isSetDouble_val()) {
     oprot.writeDouble(struct.double_val);
   }
   if (struct.isSetNull_val()) {
     oprot.writeBool(struct.null_val);
   }
   if (struct.isSetRef_val()) {
     oprot.writeI32(struct.ref_val);
   }
   if (struct.isSetArray_val()) {
     {
       oprot.writeI32(struct.array_val.size());
       for (int _iter116 : struct.array_val) {
         oprot.writeI32(_iter116);
       }
     }
   }
 }