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

@@ -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.
@@ -30,10 +30,10 @@ import org.springframework.lang.Nullable;
public class ObjectOptimisticLockingFailureException extends OptimisticLockingFailureException {
@Nullable
private Object persistentClass;
private final Object persistentClass;
@Nullable
private Object identifier;
private final Object identifier;
/**
@@ -44,6 +44,8 @@ public class ObjectOptimisticLockingFailureException extends OptimisticLockingFa
*/
public ObjectOptimisticLockingFailureException(String msg, Throwable cause) {
super(msg, cause);
this.persistentClass = null;
this.identifier = null;
}
/**

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.
@@ -30,10 +30,10 @@ import org.springframework.lang.Nullable;
public class ObjectRetrievalFailureException extends DataRetrievalFailureException {
@Nullable
private Object persistentClass;
private final Object persistentClass;
@Nullable
private Object identifier;
private final Object identifier;
/**
@@ -44,6 +44,8 @@ public class ObjectRetrievalFailureException extends DataRetrievalFailureExcepti
*/
public ObjectRetrievalFailureException(String msg, Throwable cause) {
super(msg, cause);
this.persistentClass = null;
this.identifier = null;
}
/**

View File

@@ -890,7 +890,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
* Holder for suspended resources.
* Used internally by {@code doSuspend} and {@code doResume}.
*/
private static class SuspendedResourcesHolder {
private static final class SuspendedResourcesHolder {
private final SessionHolder sessionHolder;

View File

@@ -242,7 +242,7 @@ public abstract class ExtendedEntityManagerCreator {
* InvocationHandler for extended EntityManagers as defined in the JPA spec.
*/
@SuppressWarnings("serial")
private static class ExtendedEntityManagerInvocationHandler implements InvocationHandler, Serializable {
private static final class ExtendedEntityManagerInvocationHandler implements InvocationHandler, Serializable {
private static final Log logger = LogFactory.getLog(ExtendedEntityManagerInvocationHandler.class);

View File

@@ -745,7 +745,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
* Holder for suspended resources.
* Used internally by {@code doSuspend} and {@code doResume}.
*/
private static class SuspendedResourcesHolder {
private static final class SuspendedResourcesHolder {
private final EntityManagerHolder entityManagerHolder;