forked from mtusi2026/mtusi2026lab6
Перенос кода из ЛР5 в ЛР6 (начало)
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package ru.mtusi.messenger.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
public class IdempotencyId implements Serializable {
|
||||
private String key;
|
||||
private UUID userId;
|
||||
private UUID chatId;
|
||||
|
||||
public IdempotencyId() {}
|
||||
public IdempotencyId(String key, UUID userId, UUID chatId) {
|
||||
this.key = key;
|
||||
this.userId = userId;
|
||||
this.chatId = chatId;
|
||||
}
|
||||
|
||||
// equals и hashCode обязательны для JPA
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
IdempotencyId that = (IdempotencyId) o;
|
||||
return Objects.equals(key, that.key) && Objects.equals(userId, that.userId) && Objects.equals(chatId, that.chatId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(key, userId, chatId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user