コード例 #1
0
  public boolean equals(Result that) {
    if (that == null) return false;

    boolean this_present_value = true && this.isSetValue();
    boolean that_present_value = true && that.isSetValue();
    if (this_present_value || that_present_value) {
      if (!(this_present_value && that_present_value)) return false;
      if (!this.value.equals(that.value)) return false;
    }

    boolean this_present_error = true && this.isSetError();
    boolean that_present_error = true && that.isSetError();
    if (this_present_error || that_present_error) {
      if (!(this_present_error && that_present_error)) return false;
      if (!this.error.equals(that.error)) return false;
    }

    boolean this_present_errortext = true && this.isSetErrortext();
    boolean that_present_errortext = true && that.isSetErrortext();
    if (this_present_errortext || that_present_errortext) {
      if (!(this_present_errortext && that_present_errortext)) return false;
      if (!this.errortext.equals(that.errortext)) return false;
    }

    return true;
  }
コード例 #2
0
 /** Performs a deep copy on <i>other</i>. */
 public Result(Result other) {
   if (other.isSetValue()) {
     this.value = other.value;
   }
   if (other.isSetError()) {
     this.error = other.error;
   }
   if (other.isSetErrortext()) {
     this.errortext = other.errortext;
   }
 }
コード例 #3
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, Result struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetValue()) {
     optionals.set(0);
   }
   if (struct.isSetError()) {
     optionals.set(1);
   }
   if (struct.isSetErrortext()) {
     optionals.set(2);
   }
   oprot.writeBitSet(optionals, 3);
   if (struct.isSetValue()) {
     oprot.writeString(struct.value);
   }
   if (struct.isSetError()) {
     oprot.writeI32(struct.error.getValue());
   }
   if (struct.isSetErrortext()) {
     oprot.writeString(struct.errortext);
   }
 }
コード例 #4
0
  @Override
  public int compareTo(Result other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetValue()).compareTo(other.isSetValue());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetValue()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, other.value);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetError()).compareTo(other.isSetError());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetError()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.error, other.error);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetErrortext()).compareTo(other.isSetErrortext());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetErrortext()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.errortext, other.errortext);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
コード例 #5
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, Result 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: // VALUE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.value = iprot.readString();
              struct.setValueIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // ERROR
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.error = kvstore.ErrorCode.findByValue(iprot.readI32());
              struct.setErrorIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // ERRORTEXT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.errortext = iprot.readString();
              struct.setErrortextIsSet(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();
    }
コード例 #6
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, Result struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.value != null) {
        oprot.writeFieldBegin(VALUE_FIELD_DESC);
        oprot.writeString(struct.value);
        oprot.writeFieldEnd();
      }
      if (struct.error != null) {
        oprot.writeFieldBegin(ERROR_FIELD_DESC);
        oprot.writeI32(struct.error.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.errortext != null) {
        oprot.writeFieldBegin(ERRORTEXT_FIELD_DESC);
        oprot.writeString(struct.errortext);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
コード例 #7
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, Result struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(3);
   if (incoming.get(0)) {
     struct.value = iprot.readString();
     struct.setValueIsSet(true);
   }
   if (incoming.get(1)) {
     struct.error = kvstore.ErrorCode.findByValue(iprot.readI32());
     struct.setErrorIsSet(true);
   }
   if (incoming.get(2)) {
     struct.errortext = iprot.readString();
     struct.setErrortextIsSet(true);
   }
 }