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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.start != null) {
        oprot.writeFieldBegin(START_FIELD_DESC);
        struct.start.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.stop != null) {
        oprot.writeFieldBegin(STOP_FIELD_DESC);
        struct.stop.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(START_KEY_INCLUSIVE_FIELD_DESC);
      oprot.writeBool(struct.startKeyInclusive);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(STOP_KEY_INCLUSIVE_FIELD_DESC);
      oprot.writeBool(struct.stopKeyInclusive);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(INFINITE_START_KEY_FIELD_DESC);
      oprot.writeBool(struct.infiniteStartKey);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(INFINITE_STOP_KEY_FIELD_DESC);
      oprot.writeBool(struct.infiniteStopKey);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
Beispiel #2
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, TRange 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: // START
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.start = new TKey();
              struct.start.read(iprot);
              struct.setStartIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // STOP
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.stop = new TKey();
              struct.stop.read(iprot);
              struct.setStopIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // START_KEY_INCLUSIVE
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.startKeyInclusive = iprot.readBool();
              struct.setStartKeyInclusiveIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // STOP_KEY_INCLUSIVE
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.stopKeyInclusive = iprot.readBool();
              struct.setStopKeyInclusiveIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // INFINITE_START_KEY
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.infiniteStartKey = iprot.readBool();
              struct.setInfiniteStartKeyIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // INFINITE_STOP_KEY
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.infiniteStopKey = iprot.readBool();
              struct.setInfiniteStopKeyIsSet(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();
    }