SEC-2828: SimDestinationMessageMatcher#toString()

This commit is contained in:
Rob Winch 2015-01-23 15:32:49 -06:00
parent 5b0f8918ce
commit 9149451b9d
2 changed files with 28 additions and 16 deletions

View File

@ -122,4 +122,11 @@ public final class SimpDestinationMessageMatcher implements MessageMatcher<Objec
return messageTypeMatcher;
}
@Override
public String toString() {
return "SimpDestinationMessageMatcher [matcher=" + matcher
+ ", messageTypeMatcher=" + messageTypeMatcher + ", pattern="
+ pattern + "]";
}
}

View File

@ -19,7 +19,6 @@ import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;
import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
import org.springframework.messaging.simp.SimpMessageType;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
@ -38,7 +37,9 @@ public class SimpMessageTypeMatcher implements MessageMatcher<Object> {
/**
* Creates a new instance
*
* @param typeToMatch the {@link SimpMessageType} that will result in a match. Cannot be null.
* @param typeToMatch
* the {@link SimpMessageType} that will result in a match.
* Cannot be null.
*/
public SimpMessageTypeMatcher(SimpMessageType typeToMatch) {
Assert.notNull(typeToMatch, "typeToMatch cannot be null");
@ -53,23 +54,27 @@ public class SimpMessageTypeMatcher implements MessageMatcher<Object> {
return typeToMatch == messageType;
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof SimpMessageTypeMatcher)) {
return false;
}
SimpMessageTypeMatcher otherMatcher = (SimpMessageTypeMatcher) other;
return ObjectUtils.nullSafeEquals(this.typeToMatch, otherMatcher.typeToMatch);
if (this == other) {
return true;
}
if (!(other instanceof SimpMessageTypeMatcher)) {
return false;
}
SimpMessageTypeMatcher otherMatcher = (SimpMessageTypeMatcher) other;
return ObjectUtils.nullSafeEquals(this.typeToMatch,
otherMatcher.typeToMatch);
}
public int hashCode() {
// Using nullSafeHashCode for proper array hashCode handling
return ObjectUtils.nullSafeHashCode(this.typeToMatch);
}
public int hashCode() {
// Using nullSafeHashCode for proper array hashCode handling
return ObjectUtils.nullSafeHashCode(this.typeToMatch);
}
@Override
public String toString() {
return "SimpMessageTypeMatcher [typeToMatch=" + typeToMatch + "]";
}
}