Exemplo n.º 1
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, FrontendRequest struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.type != null) {
        if (struct.isSetType()) {
          oprot.writeFieldBegin(TYPE_FIELD_DESC);
          oprot.writeI32(struct.type.getValue());
          oprot.writeFieldEnd();
        }
      }
      if (struct.startBuild != null) {
        if (struct.isSetStartBuild()) {
          oprot.writeFieldBegin(START_BUILD_FIELD_DESC);
          struct.startBuild.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.buildStatus != null) {
        if (struct.isSetBuildStatus()) {
          oprot.writeFieldBegin(BUILD_STATUS_FIELD_DESC);
          struct.buildStatus.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
Exemplo n.º 2
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, FrontendRequest 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: // TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.type =
                  com.facebook.buck.distributed.thrift.FrontendRequestType.findByValue(
                      iprot.readI32());
              struct.setTypeIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // START_BUILD
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.startBuild = new StartBuildRequest();
              struct.startBuild.read(iprot);
              struct.setStartBuildIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // BUILD_STATUS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.buildStatus = new BuildStatusRequest();
              struct.buildStatus.read(iprot);
              struct.setBuildStatusIsSet(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();
    }