SEC-2825: Polish

This commit is contained in:
Rob Winch 2015-02-24 18:11:47 -06:00
parent ef3b9de766
commit f198804504
3 changed files with 18 additions and 21 deletions

View File

@ -28,8 +28,8 @@ import org.apache.commons.logging.Log;
*
* @since 4.0
*/
public abstract class AbstractMessageMatcherComposite<T> implements MessageMatcher<T> {
private final Log logger = getLog(getClass());
abstract class AbstractMessageMatcherComposite<T> implements MessageMatcher<T> {
protected final Log LOGGER = getLog(getClass());
private final List<MessageMatcher<T>> messageMatchers;
@ -53,17 +53,14 @@ public abstract class AbstractMessageMatcherComposite<T> implements MessageMatch
* @param messageMatchers the {@link MessageMatcher} instances to try
*/
@SafeVarargs
public AbstractMessageMatcherComposite(MessageMatcher<T>... messagetMatchers) {
this(asList(messagetMatchers));
public AbstractMessageMatcherComposite(MessageMatcher<T>... messageMatchers) {
this(asList(messageMatchers));
}
public List<MessageMatcher<T>> getMessageMatchers() {
return messageMatchers;
}
public Log getLogger() {
return logger;
}
@Override
public String toString() {
return getClass().getSimpleName()+ "[messageMatchers=" + messageMatchers + "]";

View File

@ -24,7 +24,7 @@ import org.springframework.messaging.Message;
*
* @since 4.0
*/
public class AndMessageMatcher<T> extends AbstractMessageMatcherComposite<T> {
public final class AndMessageMatcher<T> extends AbstractMessageMatcherComposite<T> {
/**
* Creates a new instance
*
@ -40,23 +40,23 @@ public class AndMessageMatcher<T> extends AbstractMessageMatcherComposite<T> {
* @param messageMatchers the {@link MessageMatcher} instances to try
*/
@SafeVarargs
public AndMessageMatcher(MessageMatcher<T>... messagetMatchers) {
super(messagetMatchers);
public AndMessageMatcher(MessageMatcher<T>... messageMatchers) {
super(messageMatchers);
}
@Override
public boolean matches(Message<? extends T> message) {
for (MessageMatcher<T> matcher : getMessageMatchers()) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Trying to match using " + matcher);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Trying to match using " + matcher);
}
if (!matcher.matches(message)) {
getLogger().debug("Did not match");
LOGGER.debug("Did not match");
return false;
}
}
getLogger().debug("All messagetMatchers returned true");
LOGGER.debug("All messageMatchers returned true");
return true;
}
}

View File

@ -24,7 +24,7 @@ import org.springframework.messaging.Message;
*
* @since 4.0
*/
public class OrMessageMatcher<T> extends AbstractMessageMatcherComposite<T> {
public final class OrMessageMatcher<T> extends AbstractMessageMatcherComposite<T> {
/**
* Creates a new instance
*
@ -40,23 +40,23 @@ public class OrMessageMatcher<T> extends AbstractMessageMatcherComposite<T> {
* @param messageMatchers the {@link MessageMatcher} instances to try
*/
@SafeVarargs
public OrMessageMatcher(MessageMatcher<T>... messagetMatchers) {
super(messagetMatchers);
public OrMessageMatcher(MessageMatcher<T>... messageMatchers) {
super(messageMatchers);
}
@Override
public boolean matches(Message<? extends T> message) {
for (MessageMatcher<T> matcher : getMessageMatchers()) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Trying to match using " + matcher);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Trying to match using " + matcher);
}
if (matcher.matches(message)) {
getLogger().debug("matched");
LOGGER.debug("matched");
return true;
}
}
getLogger().debug("No matches found");
LOGGER.debug("No matches found");
return false;
}
}