Fixed that for AccountTransactionEntity comparing didn't work
This commit is contained in:
parent
6f354724be
commit
725e0ef881
|
@ -61,4 +61,13 @@ open class AccountTransactionEntity(
|
||||||
null, null, null, null, null, null, null, null, null, null, null, null, null,
|
null, null, null, null, null, null, null, null, null, null, null, null, null,
|
||||||
null, "", "", null, null, "", null)
|
null, "", "", null, null, "", null)
|
||||||
|
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
return doesEqual(other)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
return calculateHashCode()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -68,35 +68,11 @@ open class AccountTransaction(
|
||||||
|
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (this === other) return true
|
return doesEqual(other)
|
||||||
if (other !is AccountTransaction) return false
|
|
||||||
|
|
||||||
if (bankAccount != other.bankAccount) return false
|
|
||||||
if (amount != other.amount) return false
|
|
||||||
if (currency != other.currency) return false
|
|
||||||
if (unparsedUsage != other.unparsedUsage) return false
|
|
||||||
if (bookingDate != other.bookingDate) return false
|
|
||||||
if (otherPartyName != other.otherPartyName) return false
|
|
||||||
if (otherPartyBankCode != other.otherPartyBankCode) return false
|
|
||||||
if (otherPartyAccountId != other.otherPartyAccountId) return false
|
|
||||||
if (bookingText != other.bookingText) return false
|
|
||||||
if (valueDate != other.valueDate) return false
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
var result = bankAccount.hashCode()
|
return calculateHashCode()
|
||||||
result = 31 * result + amount.hashCode()
|
|
||||||
result = 31 * result + currency.hashCode()
|
|
||||||
result = 31 * result + unparsedUsage.hashCode()
|
|
||||||
result = 31 * result + bookingDate.hashCode()
|
|
||||||
result = 31 * result + (otherPartyName?.hashCode() ?: 0)
|
|
||||||
result = 31 * result + (otherPartyBankCode?.hashCode() ?: 0)
|
|
||||||
result = 31 * result + (otherPartyAccountId?.hashCode() ?: 0)
|
|
||||||
result = 31 * result + (bookingText?.hashCode() ?: 0)
|
|
||||||
result = 31 * result + valueDate.hashCode()
|
|
||||||
return result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -73,4 +73,38 @@ interface IAccountTransaction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fun doesEqual(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (other !is IAccountTransaction) return false
|
||||||
|
|
||||||
|
if (bankAccount != other.bankAccount) return false
|
||||||
|
if (amount != other.amount) return false
|
||||||
|
if (currency != other.currency) return false
|
||||||
|
if (unparsedUsage != other.unparsedUsage) return false
|
||||||
|
if (bookingDate != other.bookingDate) return false
|
||||||
|
if (otherPartyName != other.otherPartyName) return false
|
||||||
|
if (otherPartyBankCode != other.otherPartyBankCode) return false
|
||||||
|
if (otherPartyAccountId != other.otherPartyAccountId) return false
|
||||||
|
if (bookingText != other.bookingText) return false
|
||||||
|
if (valueDate != other.valueDate) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
fun calculateHashCode(): Int {
|
||||||
|
var result = bankAccount.hashCode()
|
||||||
|
result = 31 * result + amount.hashCode()
|
||||||
|
result = 31 * result + currency.hashCode()
|
||||||
|
result = 31 * result + unparsedUsage.hashCode()
|
||||||
|
result = 31 * result + bookingDate.hashCode()
|
||||||
|
result = 31 * result + (otherPartyName?.hashCode() ?: 0)
|
||||||
|
result = 31 * result + (otherPartyBankCode?.hashCode() ?: 0)
|
||||||
|
result = 31 * result + (otherPartyAccountId?.hashCode() ?: 0)
|
||||||
|
result = 31 * result + (bookingText?.hashCode() ?: 0)
|
||||||
|
result = 31 * result + valueDate.hashCode()
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue