Polishing

(cherry picked from commit 40efcc9)
This commit is contained in:
Juergen Hoeller
2018-06-28 14:51:31 +02:00
parent 3e64388b20
commit a631af80c1
113 changed files with 648 additions and 693 deletions

View File

@@ -30,33 +30,17 @@ import org.springframework.lang.Nullable;
* @author Rossen Stoyanchev
* @since 4.0
*/
public abstract class AbstractMessageCondition<T extends AbstractMessageCondition<T>>
implements MessageCondition<T> {
/**
* Return the collection of objects the message condition is composed of
* (e.g. destination patterns), never {@code null}.
*/
protected abstract Collection<?> getContent();
/**
* The notation to use when printing discrete items of content.
* For example " || " for URL patterns or " && " for param expressions.
*/
protected abstract String getToStringInfix();
public abstract class AbstractMessageCondition<T extends AbstractMessageCondition<T>> implements MessageCondition<T> {
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}
if (obj != null && getClass() == obj.getClass()) {
AbstractMessageCondition<?> other = (AbstractMessageCondition<?>) obj;
return getContent().equals(other.getContent());
if (other == null || getClass() != other.getClass()) {
return false;
}
return false;
return getContent().equals(((AbstractMessageCondition<?>) other).getContent());
}
@Override
@@ -78,4 +62,17 @@ public abstract class AbstractMessageCondition<T extends AbstractMessageConditio
return builder.toString();
}
/**
* Return the collection of objects the message condition is composed of
* (e.g. destination patterns), never {@code null}.
*/
protected abstract Collection<?> getContent();
/**
* The notation to use when printing discrete items of content.
* For example " || " for URL patterns or " && " for param expressions.
*/
protected abstract String getToStringInfix();
}

View File

@@ -93,16 +93,16 @@ public class SimpMessageMappingInfo implements MessageCondition<SimpMessageMappi
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (obj != null && obj instanceof SimpMessageMappingInfo) {
SimpMessageMappingInfo other = (SimpMessageMappingInfo) obj;
return (this.destinationConditions.equals(other.destinationConditions) &&
this.messageTypeMessageCondition.equals(other.messageTypeMessageCondition));
if (!(other instanceof SimpMessageMappingInfo)) {
return false;
}
return false;
SimpMessageMappingInfo otherInfo = (SimpMessageMappingInfo) other;
return (this.destinationConditions.equals(otherInfo.destinationConditions) &&
this.messageTypeMessageCondition.equals(otherInfo.messageTypeMessageCondition));
}
@Override