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

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.title != null) {
      oprot.writeFieldBegin(TITLE_FIELD_DESC);
      oprot.writeString(this.title);
      oprot.writeFieldEnd();
    }
    if (this.content != null) {
      oprot.writeFieldBegin(CONTENT_FIELD_DESC);
      oprot.writeString(this.content);
      oprot.writeFieldEnd();
    }
    if (this.summary != null) {
      oprot.writeFieldBegin(SUMMARY_FIELD_DESC);
      oprot.writeString(this.summary);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(PUBLISH_TIME_FIELD_DESC);
    oprot.writeI64(this.publishTime);
    oprot.writeFieldEnd();
    if (this.originalUrl != null) {
      oprot.writeFieldBegin(ORIGINAL_URL_FIELD_DESC);
      oprot.writeString(this.originalUrl);
      oprot.writeFieldEnd();
    }
    if (this.articleFrom != null) {
      oprot.writeFieldBegin(ARTICLE_FROM_FIELD_DESC);
      oprot.writeString(this.articleFrom);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(ARTICLE_TYPE_FIELD_DESC);
    oprot.writeI32(this.articleType);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(TOP_DAY_FIELD_DESC);
    oprot.writeI32(this.topDay);
    oprot.writeFieldEnd();
    if (this.imageItems != null) {
      oprot.writeFieldBegin(IMAGE_ITEMS_FIELD_DESC);
      {
        oprot.writeListBegin(
            new org.apache.thrift.protocol.TList(
                org.apache.thrift.protocol.TType.STRUCT, this.imageItems.size()));
        for (TImageItem _iter11 : this.imageItems) {
          _iter11.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.articleUuid != null) {
      oprot.writeFieldBegin(ARTICLE_UUID_FIELD_DESC);
      oprot.writeString(this.articleUuid);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }
Exemplo n.º 2
0
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    org.apache.thrift.protocol.TField field;
    iprot.readStructBegin();
    while (true) {
      field = iprot.readFieldBegin();
      if (field.type == org.apache.thrift.protocol.TType.STOP) {
        break;
      }
      switch (field.id) {
        case 1: // TITLE
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.title = iprot.readString();
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // CONTENT
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.content = iprot.readString();
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // SUMMARY
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.summary = iprot.readString();
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // PUBLISH_TIME
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.publishTime = iprot.readI64();
            setPublishTimeIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // ORIGINAL_URL
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.originalUrl = iprot.readString();
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // ARTICLE_FROM
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.articleFrom = iprot.readString();
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // ARTICLE_TYPE
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.articleType = iprot.readI32();
            setArticleTypeIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 9: // TOP_DAY
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.topDay = iprot.readI32();
            setTopDayIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 10: // IMAGE_ITEMS
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
            {
              org.apache.thrift.protocol.TList _list8 = iprot.readListBegin();
              this.imageItems = new ArrayList<TImageItem>(_list8.size);
              for (int _i9 = 0; _i9 < _list8.size; ++_i9) {
                TImageItem _elem10; // required
                _elem10 = new TImageItem();
                _elem10.read(iprot);
                this.imageItems.add(_elem10);
              }
              iprot.readListEnd();
            }
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 11: // ARTICLE_UUID
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.articleUuid = iprot.readString();
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    validate();
  }