예제 #1
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, TFetchResultsReq 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: // OPERATION_HANDLE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.operationHandle = new TOperationHandle();
              struct.operationHandle.read(iprot);
              struct.setOperationHandleIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // ORIENTATION
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.orientation = TFetchOrientation.findByValue(iprot.readI32());
              struct.setOrientationIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // MAX_ROWS
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.maxRows = iprot.readI64();
              struct.setMaxRowsIsSet(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
      if (!struct.isSetMaxRows()) {
        throw new org.apache.thrift.protocol.TProtocolException(
            "Required field 'maxRows' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }
예제 #2
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, TFetchResultsReq struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.operationHandle != null) {
        oprot.writeFieldBegin(OPERATION_HANDLE_FIELD_DESC);
        struct.operationHandle.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.orientation != null) {
        oprot.writeFieldBegin(ORIENTATION_FIELD_DESC);
        oprot.writeI32(struct.orientation.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(MAX_ROWS_FIELD_DESC);
      oprot.writeI64(struct.maxRows);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }