@Override
  public int compareTo(TransferMessage other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetOrig_branchId()).compareTo(other.isSetOrig_branchId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOrig_branchId()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.orig_branchId, other.orig_branchId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAmount()).compareTo(other.isSetAmount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAmount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.amount, other.amount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, TransferMessage struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(2);
   if (incoming.get(0)) {
     struct.orig_branchId = new BranchID();
     struct.orig_branchId.read(iprot);
     struct.setOrig_branchIdIsSet(true);
   }
   if (incoming.get(1)) {
     struct.amount = iprot.readI32();
     struct.setAmountIsSet(true);
   }
 }
 /** Performs a deep copy on <i>other</i>. */
 public TransferMessage(TransferMessage other) {
   __isset_bitfield = other.__isset_bitfield;
   if (other.isSetOrig_branchId()) {
     this.orig_branchId = new BranchID(other.orig_branchId);
   }
   this.amount = other.amount;
 }
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, TransferMessage struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetOrig_branchId()) {
     optionals.set(0);
   }
   if (struct.isSetAmount()) {
     optionals.set(1);
   }
   oprot.writeBitSet(optionals, 2);
   if (struct.isSetOrig_branchId()) {
     struct.orig_branchId.write(oprot);
   }
   if (struct.isSetAmount()) {
     oprot.writeI32(struct.amount);
   }
 }
    public void read(org.apache.thrift.protocol.TProtocol iprot, TransferMessage 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: // ORIG_BRANCH_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.orig_branchId = new BranchID();
              struct.orig_branchId.read(iprot);
              struct.setOrig_branchIdIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // AMOUNT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.amount = iprot.readI32();
              struct.setAmountIsSet(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();
    }
    public void write(org.apache.thrift.protocol.TProtocol oprot, TransferMessage struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.orig_branchId != null) {
        oprot.writeFieldBegin(ORIG_BRANCH_ID_FIELD_DESC);
        struct.orig_branchId.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(AMOUNT_FIELD_DESC);
      oprot.writeI32(struct.amount);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
  public boolean equals(TransferMessage that) {
    if (that == null) return false;

    boolean this_present_orig_branchId = true && this.isSetOrig_branchId();
    boolean that_present_orig_branchId = true && that.isSetOrig_branchId();
    if (this_present_orig_branchId || that_present_orig_branchId) {
      if (!(this_present_orig_branchId && that_present_orig_branchId)) return false;
      if (!this.orig_branchId.equals(that.orig_branchId)) return false;
    }

    boolean this_present_amount = true;
    boolean that_present_amount = true;
    if (this_present_amount || that_present_amount) {
      if (!(this_present_amount && that_present_amount)) return false;
      if (this.amount != that.amount) return false;
    }

    return true;
  }