Пример #1
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, Type struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(2);
   if (incoming.get(0)) {
     {
       org.apache.thrift.protocol.TMap _map6 =
           new org.apache.thrift.protocol.TMap(
               org.apache.thrift.protocol.TType.I32,
               org.apache.thrift.protocol.TType.STRUCT,
               iprot.readI32());
       struct.types = new HashMap<Integer, Typ>(2 * _map6.size);
       for (int _i7 = 0; _i7 < _map6.size; ++_i7) {
         int _key8; // required
         Typ _val9; // required
         _key8 = iprot.readI32();
         _val9 = new Typ();
         _val9.read(iprot);
         struct.types.put(_key8, _val9);
       }
     }
     struct.setTypesIsSet(true);
   }
   if (incoming.get(1)) {
     struct.root = iprot.readI32();
     struct.setRootIsSet(true);
   }
 }
Пример #2
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, Type 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: // TYPES
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin();
                struct.types = new HashMap<Integer, Typ>(2 * _map0.size);
                for (int _i1 = 0; _i1 < _map0.size; ++_i1) {
                  int _key2; // required
                  Typ _val3; // required
                  _key2 = iprot.readI32();
                  _val3 = new Typ();
                  _val3.read(iprot);
                  struct.types.put(_key2, _val3);
                }
                iprot.readMapEnd();
              }
              struct.setTypesIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // ROOT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.root = iprot.readI32();
              struct.setRootIsSet(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();
    }