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

    int lastComparison = 0;
    TPermissionsUpdate typedOther = (TPermissionsUpdate) other;

    lastComparison = Boolean.valueOf(isSetHasfullImage()).compareTo(typedOther.isSetHasfullImage());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHasfullImage()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.hasfullImage, typedOther.hasfullImage);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetSeqNum()).compareTo(typedOther.isSetSeqNum());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSeqNum()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.seqNum, typedOther.seqNum);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison =
        Boolean.valueOf(isSetPrivilegeChanges()).compareTo(typedOther.isSetPrivilegeChanges());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPrivilegeChanges()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(
              this.privilegeChanges, typedOther.privilegeChanges);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRoleChanges()).compareTo(typedOther.isSetRoleChanges());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRoleChanges()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.roleChanges, typedOther.roleChanges);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
    public void read(org.apache.thrift.protocol.TProtocol iprot, TPermissionsUpdate 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: // HASFULL_IMAGE
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.hasfullImage = iprot.readBool();
              struct.setHasfullImageIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // SEQ_NUM
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.seqNum = iprot.readI64();
              struct.setSeqNumIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // PRIVILEGE_CHANGES
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map102 = iprot.readMapBegin();
                struct.privilegeChanges = new HashMap<String, TPrivilegeChanges>(2 * _map102.size);
                for (int _i103 = 0; _i103 < _map102.size; ++_i103) {
                  String _key104; // required
                  TPrivilegeChanges _val105; // required
                  _key104 = iprot.readString();
                  _val105 = new TPrivilegeChanges();
                  _val105.read(iprot);
                  struct.privilegeChanges.put(_key104, _val105);
                }
                iprot.readMapEnd();
              }
              struct.setPrivilegeChangesIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // ROLE_CHANGES
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map106 = iprot.readMapBegin();
                struct.roleChanges = new HashMap<String, TRoleChanges>(2 * _map106.size);
                for (int _i107 = 0; _i107 < _map106.size; ++_i107) {
                  String _key108; // required
                  TRoleChanges _val109; // required
                  _key108 = iprot.readString();
                  _val109 = new TRoleChanges();
                  _val109.read(iprot);
                  struct.roleChanges.put(_key108, _val109);
                }
                iprot.readMapEnd();
              }
              struct.setRoleChangesIsSet(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.isSetHasfullImage()) {
        throw new org.apache.thrift.protocol.TProtocolException(
            "Required field 'hasfullImage' was not found in serialized data! Struct: "
                + toString());
      }
      if (!struct.isSetSeqNum()) {
        throw new org.apache.thrift.protocol.TProtocolException(
            "Required field 'seqNum' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }