Override equals and hashCode for DeviceEntity

This commit is contained in:
Mikhail Yasnov 2021-07-15 11:28:35 +03:00
parent 8463eea777
commit ba35eb76c2
1 changed files with 14 additions and 0 deletions

View File

@ -25,6 +25,20 @@ class DeviceEntity: AuditableUuidIdEntity() {
)
lateinit var users: Set<UserEntity>
override fun equals(other: Any?): Boolean {
if (other == null || this.javaClass != other.javaClass) {
return false
}
other as DeviceEntity
return this.id == other.id
}
override fun hashCode(): Int {
return this.id.hashCode()
}
companion object {
fun create(platform: DevicePlatform): DeviceEntity {
return DeviceEntity().apply {