Пример #1
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, ErrorModel struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.errorId != null) {
        oprot.writeFieldBegin(ERROR_ID_FIELD_DESC);
        oprot.writeString(struct.errorId);
        oprot.writeFieldEnd();
      }
      if (struct.isSetCreationTime()) {
        oprot.writeFieldBegin(CREATION_TIME_FIELD_DESC);
        oprot.writeI64(struct.creationTime);
        oprot.writeFieldEnd();
      }
      if (struct.actualErrorMessage != null) {
        if (struct.isSetActualErrorMessage()) {
          oprot.writeFieldBegin(ACTUAL_ERROR_MESSAGE_FIELD_DESC);
          oprot.writeString(struct.actualErrorMessage);
          oprot.writeFieldEnd();
        }
      }
      if (struct.userFriendlyMessage != null) {
        if (struct.isSetUserFriendlyMessage()) {
          oprot.writeFieldBegin(USER_FRIENDLY_MESSAGE_FIELD_DESC);
          oprot.writeString(struct.userFriendlyMessage);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetTransientOrPersistent()) {
        oprot.writeFieldBegin(TRANSIENT_OR_PERSISTENT_FIELD_DESC);
        oprot.writeBool(struct.transientOrPersistent);
        oprot.writeFieldEnd();
      }
      if (struct.rootCauseErrorIdList != null) {
        if (struct.isSetRootCauseErrorIdList()) {
          oprot.writeFieldBegin(ROOT_CAUSE_ERROR_ID_LIST_FIELD_DESC);
          {
            oprot.writeListBegin(
                new org.apache.thrift.protocol.TList(
                    org.apache.thrift.protocol.TType.STRING, struct.rootCauseErrorIdList.size()));
            for (String _iter3 : struct.rootCauseErrorIdList) {
              oprot.writeString(_iter3);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
Пример #2
0
 public void read(org.apache.thrift.protocol.TProtocol iprot, ErrorModel 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: // ERROR_ID
         if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
           struct.errorId = iprot.readString();
           struct.setErrorIdIsSet(true);
         } else {
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
         break;
       case 2: // CREATION_TIME
         if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
           struct.creationTime = iprot.readI64();
           struct.setCreationTimeIsSet(true);
         } else {
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
         break;
       case 3: // ACTUAL_ERROR_MESSAGE
         if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
           struct.actualErrorMessage = iprot.readString();
           struct.setActualErrorMessageIsSet(true);
         } else {
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
         break;
       case 4: // USER_FRIENDLY_MESSAGE
         if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
           struct.userFriendlyMessage = iprot.readString();
           struct.setUserFriendlyMessageIsSet(true);
         } else {
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
         break;
       case 5: // TRANSIENT_OR_PERSISTENT
         if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
           struct.transientOrPersistent = iprot.readBool();
           struct.setTransientOrPersistentIsSet(true);
         } else {
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
         break;
       case 6: // ROOT_CAUSE_ERROR_ID_LIST
         if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
           {
             org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
             struct.rootCauseErrorIdList = new ArrayList<String>(_list0.size);
             String _elem1;
             for (int _i2 = 0; _i2 < _list0.size; ++_i2) {
               _elem1 = iprot.readString();
               struct.rootCauseErrorIdList.add(_elem1);
             }
             iprot.readListEnd();
           }
           struct.setRootCauseErrorIdListIsSet(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();
   struct.validate();
 }