Skip to content

Commit 4ff1e3e

Browse files
committed
Consistent abstract declaration for utility classes (plus polishing)
Issue: SPR-16968
1 parent e72f4ec commit 4ff1e3e

File tree

21 files changed

+31
-77
lines changed

21 files changed

+31
-77
lines changed

spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@
4343
* Decorator for a standard {@link BeanInfo} object, e.g. as created by
4444
* {@link Introspector#getBeanInfo(Class)}, designed to discover and register static
4545
* and/or non-void returning setter methods. For example:
46+
*
4647
* <pre class="code">
4748
* public class Bean {
49+
*
4850
* private Foo foo;
4951
*
5052
* public Foo getFoo() {
@@ -56,6 +58,7 @@
5658
* return this;
5759
* }
5860
* }</pre>
61+
*
5962
* The standard JavaBeans {@code Introspector} will discover the {@code getFoo} read
6063
* method, but will bypass the {@code #setFoo(Foo)} write method, because its non-void
6164
* returning signature does not comply with the JavaBeans specification.
@@ -68,6 +71,7 @@
6871
* indexed properties</a> are fully supported.
6972
*
7073
* @author Chris Beams
74+
* @author Juergen Hoeller
7175
* @since 3.1
7276
* @see #ExtendedBeanInfo(BeanInfo)
7377
* @see ExtendedBeanInfoFactory
@@ -79,8 +83,7 @@ class ExtendedBeanInfo implements BeanInfo {
7983

8084
private final BeanInfo delegate;
8185

82-
private final Set<PropertyDescriptor> propertyDescriptors =
83-
new TreeSet<>(new PropertyDescriptorComparator());
86+
private final Set<PropertyDescriptor> propertyDescriptors = new TreeSet<>(new PropertyDescriptorComparator());
8487

8588

8689
/**
@@ -91,11 +94,9 @@ class ExtendedBeanInfo implements BeanInfo {
9194
* through its method descriptors to find any non-void returning write methods and
9295
* update or create the corresponding {@link PropertyDescriptor} for each one found.
9396
* @param delegate the wrapped {@code BeanInfo}, which is never modified
94-
* @throws IntrospectionException if any problems occur creating and adding new
95-
* property descriptors
9697
* @see #getPropertyDescriptors()
9798
*/
98-
public ExtendedBeanInfo(BeanInfo delegate) throws IntrospectionException {
99+
public ExtendedBeanInfo(BeanInfo delegate) {
99100
this.delegate = delegate;
100101
for (PropertyDescriptor pd : delegate.getPropertyDescriptors()) {
101102
try {
@@ -214,8 +215,8 @@ private String propertyNameFor(Method method) {
214215

215216
/**
216217
* Return the set of {@link PropertyDescriptor PropertyDescriptors} from the wrapped
217-
* {@link BeanInfo} object as well as {@code PropertyDescriptor BeanInfo} object as well as {@code PropertyDescriptors}
218-
* for each non-void returning setter method found during construction.
218+
* {@link BeanInfo} object as well as {@code PropertyDescriptors} for each non-void
219+
* returning setter method found during construction.
219220
* @see #ExtendedBeanInfo(BeanInfo)
220221
*/
221222
@Override
@@ -281,7 +282,9 @@ public SimplePropertyDescriptor(PropertyDescriptor original) throws Introspectio
281282
PropertyDescriptorUtils.copyNonMethodProperties(original, this);
282283
}
283284

284-
public SimplePropertyDescriptor(String propertyName, @Nullable Method readMethod, Method writeMethod) throws IntrospectionException {
285+
public SimplePropertyDescriptor(String propertyName, @Nullable Method readMethod, Method writeMethod)
286+
throws IntrospectionException {
287+
285288
super(propertyName, null, null);
286289
this.readMethod = readMethod;
287290
this.writeMethod = writeMethod;
@@ -385,8 +388,9 @@ public SimpleIndexedPropertyDescriptor(IndexedPropertyDescriptor original) throw
385388
PropertyDescriptorUtils.copyNonMethodProperties(original, this);
386389
}
387390

388-
public SimpleIndexedPropertyDescriptor(String propertyName, @Nullable Method readMethod, @Nullable Method writeMethod,
389-
@Nullable Method indexedReadMethod, Method indexedWriteMethod) throws IntrospectionException {
391+
public SimpleIndexedPropertyDescriptor(String propertyName, @Nullable Method readMethod,
392+
@Nullable Method writeMethod, @Nullable Method indexedReadMethod, Method indexedWriteMethod)
393+
throws IntrospectionException {
390394

391395
super(propertyName, null, null, null, null);
392396
this.readMethod = readMethod;

spring-beans/src/main/java/org/springframework/beans/PropertyDescriptorUtils.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,12 @@
3030
* @author Chris Beams
3131
* @author Juergen Hoeller
3232
*/
33-
final class PropertyDescriptorUtils {
34-
35-
36-
private PropertyDescriptorUtils() {
37-
}
38-
33+
abstract class PropertyDescriptorUtils {
3934

4035
/**
4136
* See {@link java.beans.FeatureDescriptor}.
4237
*/
43-
public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDescriptor target)
44-
throws IntrospectionException {
45-
38+
public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDescriptor target) {
4639
target.setExpert(source.isExpert());
4740
target.setHidden(source.isHidden());
4841
target.setPreferred(source.isPreferred());

spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionReaderUtils.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* @see PropertiesBeanDefinitionReader
3636
* @see org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader
3737
*/
38-
public final class BeanDefinitionReaderUtils {
38+
public abstract class BeanDefinitionReaderUtils {
3939

4040
/**
4141
* Separator for generated bean names. If a class name or parent name is not
@@ -44,10 +44,6 @@ public final class BeanDefinitionReaderUtils {
4444
public static final String GENERATED_BEAN_NAME_SEPARATOR = BeanFactoryUtils.GENERATED_BEAN_NAME_SEPARATOR;
4545

4646

47-
private BeanDefinitionReaderUtils() {
48-
}
49-
50-
5147
/**
5248
* Create a new GenericBeanDefinition for the given parent name and class name,
5349
* eagerly loading the bean class if a ClassLoader has been specified.

spring-context/src/main/java/org/springframework/cache/config/CacheManagementConfigUtils.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @author Juergen Hoeller
2323
* @since 4.1
2424
*/
25-
public final class CacheManagementConfigUtils {
25+
public abstract class CacheManagementConfigUtils {
2626

2727
/**
2828
* The name of the cache advisor bean.
@@ -48,8 +48,4 @@ public final class CacheManagementConfigUtils {
4848
public static final String JCACHE_ASPECT_BEAN_NAME =
4949
"org.springframework.cache.config.internalJCacheAspect";
5050

51-
52-
private CacheManagementConfigUtils() {
53-
}
54-
5551
}

spring-context/src/main/java/org/springframework/context/annotation/BeanAnnotationHelper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
*/
3030
final class BeanAnnotationHelper {
3131

32-
3332
private BeanAnnotationHelper() {
3433
}
3534

spring-context/src/main/java/org/springframework/context/annotation/ScopedProxyCreator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
*/
3131
final class ScopedProxyCreator {
3232

33-
3433
private ScopedProxyCreator() {
3534
}
3635

spring-context/src/main/java/org/springframework/context/support/PostProcessorRegistrationDelegate.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
*/
5050
final class PostProcessorRegistrationDelegate {
5151

52-
5352
private PostProcessorRegistrationDelegate() {
5453
}
5554

@@ -306,7 +305,7 @@ private static void registerBeanPostProcessors(
306305
* BeanPostProcessor instantiation, i.e. when a bean is not eligible for
307306
* getting processed by all BeanPostProcessors.
308307
*/
309-
private static class BeanPostProcessorChecker implements BeanPostProcessor {
308+
private static final class BeanPostProcessorChecker implements BeanPostProcessor {
310309

311310
private static final Log logger = LogFactory.getLog(BeanPostProcessorChecker.class);
312311

spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeConverters.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
*/
4747
final class JodaTimeConverters {
4848

49-
5049
private JodaTimeConverters() {
5150
}
5251

spring-context/src/main/java/org/springframework/format/datetime/standard/DateTimeConverters.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
*/
4444
final class DateTimeConverters {
4545

46-
4746
private DateTimeConverters() {
4847
}
4948

spring-context/src/main/java/org/springframework/jmx/support/ObjectNameManager.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
*/
3131
public final class ObjectNameManager {
3232

33-
3433
private ObjectNameManager() {
3534
}
3635

0 commit comments

Comments
 (0)