Polishing
This commit is contained in:
@@ -31,33 +31,17 @@ import org.springframework.lang.Nullable;
|
||||
* @since 4.0
|
||||
* @param <T> the kind of condition that this condition can be combined with or compared to
|
||||
*/
|
||||
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
|
||||
@@ -79,4 +63,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();
|
||||
|
||||
}
|
||||
|
||||
@@ -94,16 +94,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
|
||||
|
||||
Reference in New Issue
Block a user