Beispiel #1
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, Message struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(4);
   if (incoming.get(0)) {
     struct.kind = OperationType.findByValue(iprot.readI32());
     struct.setKindIsSet(true);
   }
   if (incoming.get(1)) {
     struct.dbname = iprot.readString();
     struct.setDbnameIsSet(true);
   }
   if (incoming.get(2)) {
     {
       org.apache.thrift.protocol.TList _list10 =
           new org.apache.thrift.protocol.TList(
               org.apache.thrift.protocol.TType.STRING, iprot.readI32());
       struct.keys = new ArrayList<String>(_list10.size);
       for (int _i11 = 0; _i11 < _list10.size; ++_i11) {
         String _elem12; // required
         _elem12 = iprot.readString();
         struct.keys.add(_elem12);
       }
     }
     struct.setKeysIsSet(true);
   }
   if (incoming.get(3)) {
     {
       org.apache.thrift.protocol.TList _list13 =
           new org.apache.thrift.protocol.TList(
               org.apache.thrift.protocol.TType.STRING, iprot.readI32());
       struct.values = new ArrayList<String>(_list13.size);
       for (int _i14 = 0; _i14 < _list13.size; ++_i14) {
         String _elem15; // required
         _elem15 = iprot.readString();
         struct.values.add(_elem15);
       }
     }
     struct.setValuesIsSet(true);
   }
 }
Beispiel #2
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, Message 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: // KIND
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.kind = OperationType.findByValue(iprot.readI32());
              struct.setKindIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // DBNAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.dbname = iprot.readString();
              struct.setDbnameIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // KEYS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
                struct.keys = new ArrayList<String>(_list0.size);
                for (int _i1 = 0; _i1 < _list0.size; ++_i1) {
                  String _elem2; // required
                  _elem2 = iprot.readString();
                  struct.keys.add(_elem2);
                }
                iprot.readListEnd();
              }
              struct.setKeysIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // VALUES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list3 = iprot.readListBegin();
                struct.values = new ArrayList<String>(_list3.size);
                for (int _i4 = 0; _i4 < _list3.size; ++_i4) {
                  String _elem5; // required
                  _elem5 = iprot.readString();
                  struct.values.add(_elem5);
                }
                iprot.readListEnd();
              }
              struct.setValuesIsSet(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();
    }