@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);
   }
 }
    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();
    }