コード例 #1
0
ファイル: ProcessInfo.java プロジェクト: Kafkamorph/carat
    public void read(org.apache.thrift.protocol.TProtocol iprot, ProcessInfo 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: // P_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.pId = iprot.readI32();
              struct.setPIdIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // P_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.pName = iprot.readString();
              struct.setPNameIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // APPLICATION_LABEL
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.applicationLabel = iprot.readString();
              struct.setApplicationLabelIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // IS_SYSTEM_APP
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.isSystemApp = iprot.readBool();
              struct.setIsSystemAppIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // IMPORTANCE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.importance = iprot.readString();
              struct.setImportanceIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // VERSION_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.versionName = iprot.readString();
              struct.setVersionNameIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // VERSION_CODE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.versionCode = iprot.readI32();
              struct.setVersionCodeIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // APP_SIGNATURES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
                struct.appSignatures = new ArrayList<String>(_list0.size);
                for (int _i1 = 0; _i1 < _list0.size; ++_i1) {
                  String _elem2;
                  _elem2 = iprot.readString();
                  struct.appSignatures.add(_elem2);
                }
                iprot.readListEnd();
              }
              struct.setAppSignaturesIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // INSTALLATION_PKG
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.installationPkg = iprot.readString();
              struct.setInstallationPkgIsSet(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();
    }
コード例 #2
0
ファイル: ProcessInfo.java プロジェクト: Kafkamorph/carat
    public void write(org.apache.thrift.protocol.TProtocol oprot, ProcessInfo struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.isSetPId()) {
        oprot.writeFieldBegin(P_ID_FIELD_DESC);
        oprot.writeI32(struct.pId);
        oprot.writeFieldEnd();
      }
      if (struct.pName != null) {
        if (struct.isSetPName()) {
          oprot.writeFieldBegin(P_NAME_FIELD_DESC);
          oprot.writeString(struct.pName);
          oprot.writeFieldEnd();
        }
      }
      if (struct.applicationLabel != null) {
        if (struct.isSetApplicationLabel()) {
          oprot.writeFieldBegin(APPLICATION_LABEL_FIELD_DESC);
          oprot.writeString(struct.applicationLabel);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetIsSystemApp()) {
        oprot.writeFieldBegin(IS_SYSTEM_APP_FIELD_DESC);
        oprot.writeBool(struct.isSystemApp);
        oprot.writeFieldEnd();
      }
      if (struct.importance != null) {
        if (struct.isSetImportance()) {
          oprot.writeFieldBegin(IMPORTANCE_FIELD_DESC);
          oprot.writeString(struct.importance);
          oprot.writeFieldEnd();
        }
      }
      if (struct.versionName != null) {
        if (struct.isSetVersionName()) {
          oprot.writeFieldBegin(VERSION_NAME_FIELD_DESC);
          oprot.writeString(struct.versionName);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetVersionCode()) {
        oprot.writeFieldBegin(VERSION_CODE_FIELD_DESC);
        oprot.writeI32(struct.versionCode);
        oprot.writeFieldEnd();
      }
      if (struct.appSignatures != null) {
        if (struct.isSetAppSignatures()) {
          oprot.writeFieldBegin(APP_SIGNATURES_FIELD_DESC);
          {
            oprot.writeListBegin(
                new org.apache.thrift.protocol.TList(
                    org.apache.thrift.protocol.TType.STRING, struct.appSignatures.size()));
            for (String _iter3 : struct.appSignatures) {
              oprot.writeString(_iter3);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.installationPkg != null) {
        if (struct.isSetInstallationPkg()) {
          oprot.writeFieldBegin(INSTALLATION_PKG_FIELD_DESC);
          oprot.writeString(struct.installationPkg);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }