示例#1
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, ClusterData struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(2);
   if (incoming.get(0)) {
     struct.clusterName = iprot.readString();
     struct.setClusterNameIsSet(true);
   }
   if (incoming.get(1)) {
     {
       org.apache.thrift.protocol.TMap _map14 =
           new org.apache.thrift.protocol.TMap(
               org.apache.thrift.protocol.TType.STRING,
               org.apache.thrift.protocol.TType.STRUCT,
               iprot.readI32());
       struct.groups = new HashMap<String, GroupData>(2 * _map14.size);
       for (int _i15 = 0; _i15 < _map14.size; ++_i15) {
         String _key16; // required
         GroupData _val17; // required
         _key16 = iprot.readString();
         _val17 = new GroupData();
         _val17.read(iprot);
         struct.groups.put(_key16, _val17);
       }
     }
     struct.setGroupsIsSet(true);
   }
 }
示例#2
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, ClusterData 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: // CLUSTER_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.clusterName = iprot.readString();
              struct.setClusterNameIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // GROUPS
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map8 = iprot.readMapBegin();
                struct.groups = new HashMap<String, GroupData>(2 * _map8.size);
                for (int _i9 = 0; _i9 < _map8.size; ++_i9) {
                  String _key10; // required
                  GroupData _val11; // required
                  _key10 = iprot.readString();
                  _val11 = new GroupData();
                  _val11.read(iprot);
                  struct.groups.put(_key10, _val11);
                }
                iprot.readMapEnd();
              }
              struct.setGroupsIsSet(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();
    }