Example #1
0
  @Override
  public int compareTo(Commit other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMessage()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAuthor()).compareTo(other.isSetAuthor());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAuthor()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.author, other.author);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
Example #2
0
 /** Performs a deep copy on <i>other</i>. */
 public Commit(Commit other) {
   if (other.isSetMessage()) {
     this.message = other.message;
   }
   if (other.isSetAuthor()) {
     this.author = new CommitAuthor(other.author);
   }
 }
Example #3
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, Commit struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(2);
   if (incoming.get(0)) {
     struct.message = iprot.readString();
     struct.setMessageIsSet(true);
   }
   if (incoming.get(1)) {
     struct.author = new CommitAuthor();
     struct.author.read(iprot);
     struct.setAuthorIsSet(true);
   }
 }
Example #4
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, Commit struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetMessage()) {
     optionals.set(0);
   }
   if (struct.isSetAuthor()) {
     optionals.set(1);
   }
   oprot.writeBitSet(optionals, 2);
   if (struct.isSetMessage()) {
     oprot.writeString(struct.message);
   }
   if (struct.isSetAuthor()) {
     struct.author.write(oprot);
   }
 }
Example #5
0
  public boolean equals(Commit that) {
    if (that == null) return false;

    boolean this_present_message = true && this.isSetMessage();
    boolean that_present_message = true && that.isSetMessage();
    if (this_present_message || that_present_message) {
      if (!(this_present_message && that_present_message)) return false;
      if (!this.message.equals(that.message)) return false;
    }

    boolean this_present_author = true && this.isSetAuthor();
    boolean that_present_author = true && that.isSetAuthor();
    if (this_present_author || that_present_author) {
      if (!(this_present_author && that_present_author)) return false;
      if (!this.author.equals(that.author)) return false;
    }

    return true;
  }
Example #6
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, Commit 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: // MESSAGE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.message = iprot.readString();
              struct.setMessageIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // AUTHOR
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.author = new CommitAuthor();
              struct.author.read(iprot);
              struct.setAuthorIsSet(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();
    }
Example #7
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, Commit struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.message != null) {
        oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
        oprot.writeString(struct.message);
        oprot.writeFieldEnd();
      }
      if (struct.author != null) {
        oprot.writeFieldBegin(AUTHOR_FIELD_DESC);
        struct.author.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }