From 5528c8a93bc85a185dda8310b6b1f535c7a5a280 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 30 Dec 2014 13:11:46 +0100 Subject: [PATCH] Polishing --- .../SimpAnnotationMethodMessageHandler.java | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/support/SimpAnnotationMethodMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/support/SimpAnnotationMethodMessageHandler.java index 0ef7a6dba4..f5206a2848 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/support/SimpAnnotationMethodMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/support/SimpAnnotationMethodMessageHandler.java @@ -144,8 +144,8 @@ public class SimpAnnotationMethodMessageHandler extends AbstractMethodMessageHan } /** - * Configure a {@link ConversionService} to use when resolving method arguments, for - * example message header values. + * Configure a {@link ConversionService} to use when resolving method arguments, + * for example message header values. *

By default an instance of {@link DefaultFormattingConversionService} is used. */ public void setConversionService(ConversionService conversionService) { @@ -153,7 +153,7 @@ public class SimpAnnotationMethodMessageHandler extends AbstractMethodMessageHan } /** - * The configured {@link ConversionService}. + * Return the configured {@link ConversionService}. */ public ConversionService getConversionService() { return this.conversionService; @@ -162,7 +162,7 @@ public class SimpAnnotationMethodMessageHandler extends AbstractMethodMessageHan /** * Set the PathMatcher implementation to use for matching destinations * against configured destination patterns. - *

By default AntPathMatcher is used + *

By default, {@link AntPathMatcher} is used. */ public void setPathMatcher(PathMatcher pathMatcher) { Assert.notNull(pathMatcher, "PathMatcher must not be null"); @@ -170,14 +170,14 @@ public class SimpAnnotationMethodMessageHandler extends AbstractMethodMessageHan } /** - * Return the PathMatcher implementation to use for matching destinations + * Return the PathMatcher implementation to use for matching destinations. */ public PathMatcher getPathMatcher() { return this.pathMatcher; } /** - * The configured Validator instance + * Return the configured Validator instance. */ public Validator getValidator() { return this.validator; @@ -283,17 +283,17 @@ public class SimpAnnotationMethodMessageHandler extends AbstractMethodMessageHan @Override protected SimpMessageMappingInfo getMappingForMethod(Method method, Class handlerType) { MessageMapping typeAnnotation = AnnotationUtils.findAnnotation(handlerType, MessageMapping.class); - MessageMapping messageAnnot = AnnotationUtils.findAnnotation(method, MessageMapping.class); - if (messageAnnot != null) { - SimpMessageMappingInfo result = createMessageMappingCondition(messageAnnot); + MessageMapping messageAnnotation = AnnotationUtils.findAnnotation(method, MessageMapping.class); + if (messageAnnotation != null) { + SimpMessageMappingInfo result = createMessageMappingCondition(messageAnnotation); if (typeAnnotation != null) { result = createMessageMappingCondition(typeAnnotation).combine(result); } return result; } - SubscribeMapping subsribeAnnotation = AnnotationUtils.findAnnotation(method, SubscribeMapping.class); - if (subsribeAnnotation != null) { - SimpMessageMappingInfo result = createSubscribeCondition(subsribeAnnotation); + SubscribeMapping subscribeAnnotation = AnnotationUtils.findAnnotation(method, SubscribeMapping.class); + if (subscribeAnnotation != null) { + SimpMessageMappingInfo result = createSubscribeCondition(subscribeAnnotation); if (typeAnnotation != null) { result = createMessageMappingCondition(typeAnnotation).combine(result); } @@ -348,11 +348,10 @@ public class SimpAnnotationMethodMessageHandler extends AbstractMethodMessageHan protected void handleMatch(SimpMessageMappingInfo mapping, HandlerMethod handlerMethod, String lookupDestination, Message message) { - SimpMessageHeaderAccessor headers = SimpMessageHeaderAccessor.wrap(message); - String matchedPattern = mapping.getDestinationConditions().getPatterns().iterator().next(); Map vars = getPathMatcher().extractUriTemplateVariables(matchedPattern, lookupDestination); + SimpMessageHeaderAccessor headers = SimpMessageHeaderAccessor.wrap(message); headers.setHeader(DestinationVariableMethodArgumentResolver.DESTINATION_TEMPLATE_VARIABLES_HEADER, vars); message = MessageBuilder.withPayload(message.getPayload()).setHeaders(headers).build();