Consistent equals/hashCode style (and related polishing)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -76,13 +76,8 @@ public abstract class AbstractWebSocketMessage<T> implements WebSocketMessage<T>
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof AbstractWebSocketMessage<?> otherMessage)) {
|
||||
return false;
|
||||
}
|
||||
return ObjectUtils.nullSafeEquals(this.payload, otherMessage.payload);
|
||||
return (this == other || (other instanceof AbstractWebSocketMessage<?> that &&
|
||||
ObjectUtils.nullSafeEquals(this.payload, that.payload)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -207,13 +207,8 @@ public final class CloseStatus implements Serializable {
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof CloseStatus otherStatus)) {
|
||||
return false;
|
||||
}
|
||||
return (this.code == otherStatus.code && ObjectUtils.nullSafeEquals(this.reason, otherStatus.reason));
|
||||
return (this == other || (other instanceof CloseStatus that &&
|
||||
this.code == that.code && ObjectUtils.nullSafeEquals(this.reason, that.reason)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -309,13 +309,8 @@ public class WebSocketHttpHeaders extends HttpHeaders {
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof WebSocketHttpHeaders otherHeaders)) {
|
||||
return false;
|
||||
}
|
||||
return this.headers.equals(otherHeaders.headers);
|
||||
return (this == other || (other instanceof WebSocketHttpHeaders that &&
|
||||
this.headers.equals(that.headers)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -238,8 +238,7 @@ public class DefaultSimpUserRegistry implements SimpUserRegistry, SmartApplicati
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other ||
|
||||
(other instanceof SimpUser otherSimpUser && getName().equals(otherSimpUser.getName())));
|
||||
return (this == other || (other instanceof SimpUser that && getName().equals(that.getName())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -294,8 +293,7 @@ public class DefaultSimpUserRegistry implements SimpUserRegistry, SmartApplicati
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other ||
|
||||
(other instanceof SimpSubscription otherSubscription && getId().equals(otherSubscription.getId())));
|
||||
return (this == other || (other instanceof SimpSubscription that && getId().equals(that.getId())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -344,14 +342,9 @@ public class DefaultSimpUserRegistry implements SimpUserRegistry, SmartApplicati
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof SimpSubscription otherSubscription)) {
|
||||
return false;
|
||||
}
|
||||
return (getId().equals(otherSubscription.getId()) &&
|
||||
getSession().getId().equals(otherSubscription.getSession().getId()));
|
||||
return (this == other || (other instanceof SimpSubscription that &&
|
||||
getId().equals(that.getId()) &&
|
||||
getSession().getId().equals(that.getSession().getId())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -122,13 +122,8 @@ public class SockJsFrame {
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof SockJsFrame otherFrame)) {
|
||||
return false;
|
||||
}
|
||||
return (this.type.equals(otherFrame.type) && this.content.equals(otherFrame.content));
|
||||
return (this == other || (other instanceof SockJsFrame that &&
|
||||
this.type.equals(that.type) && this.content.equals(that.content)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user