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:
committed by
Juergen Hoeller
parent
0ad0f341bd
commit
eeebd51f57
@@ -22,7 +22,7 @@ package org.springframework.cache.config;
|
||||
* @author Juergen Hoeller
|
||||
* @since 4.1
|
||||
*/
|
||||
public class CacheManagementConfigUtils {
|
||||
public final class CacheManagementConfigUtils {
|
||||
|
||||
/**
|
||||
* The name of the cache advisor bean.
|
||||
@@ -48,4 +48,8 @@ public class CacheManagementConfigUtils {
|
||||
public static final String JCACHE_ASPECT_BEAN_NAME =
|
||||
"org.springframework.cache.config.internalJCacheAspect";
|
||||
|
||||
|
||||
private CacheManagementConfigUtils() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @see org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor
|
||||
* @see org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor
|
||||
*/
|
||||
public class AnnotationConfigUtils {
|
||||
public final class AnnotationConfigUtils {
|
||||
|
||||
/**
|
||||
* The bean name of the internally managed Configuration annotation processor.
|
||||
@@ -127,6 +127,10 @@ public class AnnotationConfigUtils {
|
||||
ClassUtils.isPresent(PERSISTENCE_ANNOTATION_PROCESSOR_CLASS_NAME, AnnotationConfigUtils.class.getClassLoader());
|
||||
|
||||
|
||||
private AnnotationConfigUtils() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register all relevant annotation post processors in the given registry.
|
||||
* @param registry the registry to operate on
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -27,7 +27,12 @@ import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
* @author Juergen Hoeller
|
||||
* @since 3.1
|
||||
*/
|
||||
class BeanAnnotationHelper {
|
||||
final class BeanAnnotationHelper {
|
||||
|
||||
|
||||
private BeanAnnotationHelper() {
|
||||
}
|
||||
|
||||
|
||||
public static boolean isBeanAnnotated(Method method) {
|
||||
return AnnotatedElementUtils.hasAnnotation(method, Bean.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -28,7 +28,12 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
* @since 3.0
|
||||
* @see org.springframework.aop.scope.ScopedProxyUtils#createScopedProxy
|
||||
*/
|
||||
class ScopedProxyCreator {
|
||||
final class ScopedProxyCreator {
|
||||
|
||||
|
||||
private ScopedProxyCreator() {
|
||||
}
|
||||
|
||||
|
||||
public static BeanDefinitionHolder createScopedProxy(
|
||||
BeanDefinitionHolder definitionHolder, BeanDefinitionRegistry registry, boolean proxyTargetClass) {
|
||||
|
||||
@@ -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.
|
||||
@@ -39,7 +39,7 @@ import org.springframework.util.ConcurrentReferenceHashMap;
|
||||
* @author Stephane Nicoll
|
||||
* @since 5.0
|
||||
*/
|
||||
public class CandidateComponentsIndexLoader {
|
||||
public final class CandidateComponentsIndexLoader {
|
||||
|
||||
/**
|
||||
* The location to look for components.
|
||||
@@ -67,6 +67,10 @@ public class CandidateComponentsIndexLoader {
|
||||
new ConcurrentReferenceHashMap<>();
|
||||
|
||||
|
||||
private CandidateComponentsIndexLoader() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load and instantiate the {@link CandidateComponentsIndex} from
|
||||
* {@value #COMPONENTS_RESOURCE_LOCATION}, using the given class loader. If no
|
||||
|
||||
@@ -48,7 +48,12 @@ import org.springframework.lang.Nullable;
|
||||
* @author Juergen Hoeller
|
||||
* @since 4.0
|
||||
*/
|
||||
class PostProcessorRegistrationDelegate {
|
||||
final class PostProcessorRegistrationDelegate {
|
||||
|
||||
|
||||
private PostProcessorRegistrationDelegate() {
|
||||
}
|
||||
|
||||
|
||||
public static void invokeBeanFactoryPostProcessors(
|
||||
ConfigurableListableBeanFactory beanFactory, List<BeanFactoryPostProcessor> beanFactoryPostProcessors) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -38,6 +38,10 @@ public final class JodaTimeContextHolder {
|
||||
new NamedThreadLocal<>("JodaTimeContext");
|
||||
|
||||
|
||||
private JodaTimeContextHolder() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reset the JodaTimeContext for the current thread.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -46,6 +46,11 @@ import org.springframework.format.datetime.DateFormatterRegistrar;
|
||||
*/
|
||||
final class JodaTimeConverters {
|
||||
|
||||
|
||||
private JodaTimeConverters() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Install the converters into the converter registry.
|
||||
* @param registry the converter registry
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -35,6 +35,10 @@ public final class DateTimeContextHolder {
|
||||
new NamedThreadLocal<>("DateTimeContext");
|
||||
|
||||
|
||||
private DateTimeContextHolder() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reset the DateTimeContext for the current thread.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -43,6 +43,11 @@ import org.springframework.format.datetime.DateFormatterRegistrar;
|
||||
*/
|
||||
final class DateTimeConverters {
|
||||
|
||||
|
||||
private DateTimeConverters() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Install the converters into the converter registry.
|
||||
* @param registry the converter registry
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
@@ -28,7 +28,12 @@ import javax.management.ObjectName;
|
||||
* @since 1.2
|
||||
* @see javax.management.ObjectName#getInstance(String)
|
||||
*/
|
||||
public class ObjectNameManager {
|
||||
public final class ObjectNameManager {
|
||||
|
||||
|
||||
private ObjectNameManager() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve the {@code ObjectName} instance corresponding to the supplied name.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -22,7 +22,7 @@ package org.springframework.scheduling.config;
|
||||
* @author Juergen Hoeller
|
||||
* @since 4.1
|
||||
*/
|
||||
public class TaskManagementConfigUtils {
|
||||
public final class TaskManagementConfigUtils {
|
||||
|
||||
/**
|
||||
* The bean name of the internally managed Scheduled annotation processor.
|
||||
@@ -42,4 +42,9 @@ public class TaskManagementConfigUtils {
|
||||
public static final String ASYNC_EXECUTION_ASPECT_BEAN_NAME =
|
||||
"org.springframework.scheduling.config.internalAsyncExecutionAspect";
|
||||
|
||||
|
||||
private TaskManagementConfigUtils() {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -29,7 +29,7 @@ import org.springframework.lang.Nullable;
|
||||
public class ScriptCompilationException extends NestedRuntimeException {
|
||||
|
||||
@Nullable
|
||||
private ScriptSource scriptSource;
|
||||
private final ScriptSource scriptSource;
|
||||
|
||||
|
||||
/**
|
||||
@@ -38,6 +38,7 @@ public class ScriptCompilationException extends NestedRuntimeException {
|
||||
*/
|
||||
public ScriptCompilationException(String msg) {
|
||||
super(msg);
|
||||
this.scriptSource = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,6 +48,7 @@ public class ScriptCompilationException extends NestedRuntimeException {
|
||||
*/
|
||||
public ScriptCompilationException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
this.scriptSource = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -225,7 +225,7 @@ public abstract class BshScriptUtils {
|
||||
* Exception to be thrown on script execution failure.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public static class BshExecutionException extends NestedRuntimeException {
|
||||
public static final class BshExecutionException extends NestedRuntimeException {
|
||||
|
||||
private BshExecutionException(EvalError ex) {
|
||||
super("BeanShell script execution failed", ex);
|
||||
|
||||
Reference in New Issue
Block a user