Beispiel #1
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, TExerciseType struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(MYID_FIELD_DESC);
      oprot.writeI32(struct.myid);
      oprot.writeFieldEnd();
      if (struct.typeName != null) {
        oprot.writeFieldBegin(TYPE_NAME_FIELD_DESC);
        oprot.writeString(struct.typeName);
        oprot.writeFieldEnd();
      }
      if (struct.createAt != null) {
        oprot.writeFieldBegin(CREATE_AT_FIELD_DESC);
        oprot.writeString(struct.createAt);
        oprot.writeFieldEnd();
      }
      if (struct.updateAt != null) {
        oprot.writeFieldBegin(UPDATE_AT_FIELD_DESC);
        oprot.writeString(struct.updateAt);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(ACTIVE_FIELD_DESC);
      oprot.writeBool(struct.active);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
Beispiel #2
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, TExerciseType 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: // MYID
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.myid = iprot.readI32();
              struct.setMyidIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // TYPE_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.typeName = iprot.readString();
              struct.setTypeNameIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // CREATE_AT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.createAt = iprot.readString();
              struct.setCreateAtIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // UPDATE_AT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.updateAt = iprot.readString();
              struct.setUpdateAtIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // ACTIVE
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.active = iprot.readBool();
              struct.setActiveIsSet(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();
    }