Use consistent class design

Update all classes so that inner classes are always last. Also
ensure that utility classes are always final and have a private
constructor and make exceptions final whenever possible.

Issue: SPR-16968
This commit is contained in:
Phillip Webb
2018-06-20 19:44:39 -07:00
committed by Juergen Hoeller
parent 0ad0f341bd
commit eeebd51f57
128 changed files with 656 additions and 455 deletions

View File

@@ -663,7 +663,7 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
context.registerComponent(new BeanComponentDefinition(beanDef, name));
}
private static class DecoratingFactoryBean implements FactoryBean<WebSocketHandler> {
private static final class DecoratingFactoryBean implements FactoryBean<WebSocketHandler> {
private final WebSocketHandler handler;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -44,7 +44,12 @@ import org.springframework.web.socket.sockjs.transport.handler.WebSocketTranspor
* @author Rossen Stoyanchev
* @since 4.0
*/
class WebSocketNamespaceUtils {
final class WebSocketNamespaceUtils {
private WebSocketNamespaceUtils() {
}
public static RuntimeBeanReference registerHandshakeHandler(
Element element, ParserContext context, @Nullable Object source) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -86,7 +86,7 @@ public class WebSocketAnnotationMethodMessageHandler extends SimpAnnotationMetho
/**
* Adapt ControllerAdviceBean to MessagingAdviceBean.
*/
private static class MessagingControllerAdviceBean implements MessagingAdviceBean {
private static final class MessagingControllerAdviceBean implements MessagingAdviceBean {
private final ControllerAdviceBean adviceBean;

View File

@@ -74,7 +74,6 @@ public abstract class AbstractSockJsService implements SockJsService, CorsConfig
private static final String XFRAME_OPTIONS_HEADER = "X-Frame-Options";
protected final Log logger = LogFactory.getLog(getClass());
private final TaskScheduler taskScheduler;
@@ -99,6 +98,10 @@ public abstract class AbstractSockJsService implements SockJsService, CorsConfig
protected final Set<String> allowedOrigins = new LinkedHashSet<>();
private final SockJsRequestHandler infoHandler = new InfoHandler();
private final SockJsRequestHandler iframeHandler = new IframeHandler();
public AbstractSockJsService(TaskScheduler scheduler) {
Assert.notNull(scheduler, "TaskScheduler must not be null");
@@ -539,7 +542,7 @@ public abstract class AbstractSockJsService implements SockJsService, CorsConfig
}
private final SockJsRequestHandler infoHandler = new SockJsRequestHandler() {
private class InfoHandler implements SockJsRequestHandler {
private static final String INFO_CONTENT =
"{\"entropy\":%s,\"origins\":[\"*:*\"],\"cookie_needed\":%s,\"websocket\":%s}";
@@ -569,7 +572,7 @@ public abstract class AbstractSockJsService implements SockJsService, CorsConfig
};
private final SockJsRequestHandler iframeHandler = new SockJsRequestHandler() {
private class IframeHandler implements SockJsRequestHandler {
private static final String IFRAME_CONTENT =
"<!DOCTYPE html>\n" +