Пример #1
0
    public void read(libthrift091.protocol.TProtocol iprot, Credential struct)
        throws libthrift091.TException {
      libthrift091.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true) {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == libthrift091.protocol.TType.STOP) {
          break;
        }
        switch (schemeField.id) {
          case 1: // TYPE
            if (schemeField.type == libthrift091.protocol.TType.I32) {
              struct.type =
                  com.xiaomi.infra.galaxy.rpc.thrift.UserType.findByValue(iprot.readI32());
              struct.setTypeIsSet(true);
            } else {
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // SECRET_KEY_ID
            if (schemeField.type == libthrift091.protocol.TType.STRING) {
              struct.secretKeyId = iprot.readString();
              struct.setSecretKeyIdIsSet(true);
            } else {
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // SECRET_KEY
            if (schemeField.type == libthrift091.protocol.TType.STRING) {
              struct.secretKey = iprot.readString();
              struct.setSecretKeyIsSet(true);
            } else {
              libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            libthrift091.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();
    }
Пример #2
0
 @Override
 public void read(libthrift091.protocol.TProtocol prot, Credential struct)
     throws libthrift091.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(3);
   if (incoming.get(0)) {
     struct.type = com.xiaomi.infra.galaxy.rpc.thrift.UserType.findByValue(iprot.readI32());
     struct.setTypeIsSet(true);
   }
   if (incoming.get(1)) {
     struct.secretKeyId = iprot.readString();
     struct.setSecretKeyIdIsSet(true);
   }
   if (incoming.get(2)) {
     struct.secretKey = iprot.readString();
     struct.setSecretKeyIsSet(true);
   }
 }