Polishing

(cherry picked from commit 2b34094)
This commit is contained in:
Juergen Hoeller
2015-02-27 22:29:42 +01:00
parent 91c47a9eb8
commit 3570a9a94a
6 changed files with 43 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,10 +29,10 @@ import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.util.CollectionUtils;
/**
* A {@link WebSocketMessageBrokerConfigurationSupport} extension that detects beans of type
* {@link WebSocketMessageBrokerConfigurer}
* and delegates to all of them allowing callback style customization of the
* configuration provided in {@link WebSocketMessageBrokerConfigurationSupport}.
* A {@link WebSocketMessageBrokerConfigurationSupport} extension that detects
* beans of type {@link WebSocketMessageBrokerConfigurer} and delegates to all
* of them allowing callback style customization of the configuration provided
* in {@link WebSocketMessageBrokerConfigurationSupport}.
*
* <p>This class is typically imported via {@link EnableWebSocketMessageBroker}.
*
@@ -42,10 +42,10 @@ import org.springframework.util.CollectionUtils;
@Configuration
public class DelegatingWebSocketMessageBrokerConfiguration extends WebSocketMessageBrokerConfigurationSupport {
private List<WebSocketMessageBrokerConfigurer> configurers = new ArrayList<WebSocketMessageBrokerConfigurer>();
private final List<WebSocketMessageBrokerConfigurer> configurers = new ArrayList<WebSocketMessageBrokerConfigurer>();
@Autowired(required=false)
@Autowired(required = false)
public void setConfigurers(List<WebSocketMessageBrokerConfigurer> configurers) {
if (!CollectionUtils.isEmpty(configurers)) {
this.configurers.addAll(configurers);
@@ -55,51 +55,51 @@ public class DelegatingWebSocketMessageBrokerConfiguration extends WebSocketMess
@Override
protected void registerStompEndpoints(StompEndpointRegistry registry) {
for (WebSocketMessageBrokerConfigurer c : this.configurers) {
c.registerStompEndpoints(registry);
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) {
configurer.registerStompEndpoints(registry);
}
}
@Override
protected void configureWebSocketTransport(WebSocketTransportRegistration registration) {
for (WebSocketMessageBrokerConfigurer c : this.configurers) {
c.configureWebSocketTransport(registration);
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) {
configurer.configureWebSocketTransport(registration);
}
}
@Override
protected void configureClientInboundChannel(ChannelRegistration registration) {
for (WebSocketMessageBrokerConfigurer c : this.configurers) {
c.configureClientInboundChannel(registration);
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) {
configurer.configureClientInboundChannel(registration);
}
}
@Override
protected void configureClientOutboundChannel(ChannelRegistration registration) {
for (WebSocketMessageBrokerConfigurer c : this.configurers) {
c.configureClientOutboundChannel(registration);
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) {
configurer.configureClientOutboundChannel(registration);
}
}
@Override
protected void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
for (WebSocketMessageBrokerConfigurer c : this.configurers) {
c.addArgumentResolvers(argumentResolvers);
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) {
configurer.addArgumentResolvers(argumentResolvers);
}
}
@Override
protected void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers) {
for (WebSocketMessageBrokerConfigurer c : this.configurers) {
c.addReturnValueHandlers(returnValueHandlers);
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) {
configurer.addReturnValueHandlers(returnValueHandlers);
}
}
@Override
protected boolean configureMessageConverters(List<MessageConverter> messageConverters) {
boolean registerDefaults = true;
for (WebSocketMessageBrokerConfigurer c : this.configurers) {
if (!c.configureMessageConverters(messageConverters)) {
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) {
if (!configurer.configureMessageConverters(messageConverters)) {
registerDefaults = false;
}
}
@@ -108,8 +108,8 @@ public class DelegatingWebSocketMessageBrokerConfiguration extends WebSocketMess
@Override
protected void configureMessageBroker(MessageBrokerRegistry registry) {
for (WebSocketMessageBrokerConfigurer c : this.configurers) {
c.configureMessageBroker(registry);
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) {
configurer.configureMessageBroker(registry);
}
}