コード例 #1
0
ファイル: SharedStruct.java プロジェクト: ivywjhua/microsvc
  @Override
  public int compareTo(SharedStruct other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetKey()).compareTo(other.isSetKey());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetKey()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.key, other.key);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    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;
      }
    }
    return 0;
  }
コード例 #2
0
ファイル: SharedStruct.java プロジェクト: ivywjhua/microsvc
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, SharedStruct struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(2);
   if (incoming.get(0)) {
     struct.key = iprot.readI32();
     struct.setKeyIsSet(true);
   }
   if (incoming.get(1)) {
     struct.value = iprot.readString();
     struct.setValueIsSet(true);
   }
 }
コード例 #3
0
 public void validate() throws org.apache.thrift.TException {
   // check for required fields
   // check for sub-struct validity
   if (success != null) {
     success.validate();
   }
 }
コード例 #4
0
ファイル: SharedStruct.java プロジェクト: ivywjhua/microsvc
 /** Performs a deep copy on <i>other</i>. */
 public SharedStruct(SharedStruct other) {
   __isset_bitfield = other.__isset_bitfield;
   this.key = other.key;
   if (other.isSetValue()) {
     this.value = other.value;
   }
 }
コード例 #5
0
ファイル: SharedStruct.java プロジェクト: ivywjhua/microsvc
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, SharedStruct struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetKey()) {
     optionals.set(0);
   }
   if (struct.isSetValue()) {
     optionals.set(1);
   }
   oprot.writeBitSet(optionals, 2);
   if (struct.isSetKey()) {
     oprot.writeI32(struct.key);
   }
   if (struct.isSetValue()) {
     oprot.writeString(struct.value);
   }
 }
コード例 #6
0
ファイル: SharedStruct.java プロジェクト: ivywjhua/microsvc
    public void read(org.apache.thrift.protocol.TProtocol iprot, SharedStruct 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: // KEY
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.key = iprot.readI32();
              struct.setKeyIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // 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;
          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();
    }
コード例 #7
0
ファイル: SharedStruct.java プロジェクト: ivywjhua/microsvc
    public void write(org.apache.thrift.protocol.TProtocol oprot, SharedStruct struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(KEY_FIELD_DESC);
      oprot.writeI32(struct.key);
      oprot.writeFieldEnd();
      if (struct.value != null) {
        oprot.writeFieldBegin(VALUE_FIELD_DESC);
        oprot.writeString(struct.value);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
コード例 #8
0
ファイル: SharedStruct.java プロジェクト: ivywjhua/microsvc
  public boolean equals(SharedStruct that) {
    if (that == null) return false;

    boolean this_present_key = true;
    boolean that_present_key = true;
    if (this_present_key || that_present_key) {
      if (!(this_present_key && that_present_key)) return false;
      if (this.key != that.key) 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;
    }

    return true;
  }