Example #1
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, SliceRange 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.STRING) {
              struct.start = iprot.readBinary();
              struct.setStartIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // FINISH
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.finish = iprot.readBinary();
              struct.setFinishIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // REVERSED
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.reversed = iprot.readBool();
              struct.setReversedIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // COUNT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.count = iprot.readI32();
              struct.setCountIsSet(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
      if (!struct.isSetReversed()) {
        throw new org.apache.thrift.protocol.TProtocolException(
            "Required field 'reversed' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetCount()) {
        throw new org.apache.thrift.protocol.TProtocolException(
            "Required field 'count' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }
Example #2
0
  public void read(TProtocol iprot) throws TException {
    TField field;
    iprot.readStructBegin();
    while (true) {
      field = iprot.readFieldBegin();
      if (field.type == TType.STOP) {
        break;
      }
      switch (field.id) {
        case 1: // START
          if (field.type == TType.STRING) {
            this.start = iprot.readBinary();
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // FINISH
          if (field.type == TType.STRING) {
            this.finish = iprot.readBinary();
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // REVERSED
          if (field.type == TType.BOOL) {
            this.reversed = iprot.readBool();
            setReversedIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // COUNT
          if (field.type == TType.I32) {
            this.count = iprot.readI32();
            setCountIsSet(true);
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          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
    if (!isSetReversed()) {
      throw new TProtocolException(
          "Required field 'reversed' was not found in serialized data! Struct: " + toString());
    }
    if (!isSetCount()) {
      throw new TProtocolException(
          "Required field 'count' was not found in serialized data! Struct: " + toString());
    }
    validate();
  }
Example #3
0
 public SliceRange(byte[] start, byte[] finish, boolean reversed, int count) {
   this();
   this.start = start;
   this.finish = finish;
   this.reversed = reversed;
   setReversedIsSet(true);
   this.count = count;
   setCountIsSet(true);
 }
Example #4
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, SliceRange struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   struct.start = iprot.readBinary();
   struct.setStartIsSet(true);
   struct.finish = iprot.readBinary();
   struct.setFinishIsSet(true);
   struct.reversed = iprot.readBool();
   struct.setReversedIsSet(true);
   struct.count = iprot.readI32();
   struct.setCountIsSet(true);
 }
Example #5
0
 public SliceRange setCount(int count) {
   this.count = count;
   setCountIsSet(true);
   return this;
 }