Merge pull request #708 from recursiveribbons/override-equals
Override equals and hashCode for CallbackGame and LoginUrl
This commit is contained in:
commit
b27f273ba7
@ -5,6 +5,8 @@ import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.Validable;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
@ -105,4 +107,22 @@ public class LoginUrl implements InputBotApiObject, Validable {
|
||||
", requestWriteAccess=" + requestWriteAccess +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) return true;
|
||||
if (!(o instanceof LoginUrl)) {
|
||||
return false;
|
||||
}
|
||||
LoginUrl loginUrl = (LoginUrl) o;
|
||||
return Objects.equals(url, loginUrl.url) &&
|
||||
Objects.equals(forwardText, loginUrl.forwardText) &&
|
||||
Objects.equals(botUsername, loginUrl.botUsername) &&
|
||||
Objects.equals(requestWriteAccess, loginUrl.requestWriteAccess);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(url, forwardText, botUsername, requestWriteAccess);
|
||||
}
|
||||
}
|
||||
|
@ -34,4 +34,14 @@ public class CallbackGame implements BotApiObject {
|
||||
public String toString() {
|
||||
return "CallbackGame{}";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return o == this || o instanceof CallbackGame;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getClass().hashCode();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user