Skip to content

Commit 8c07c6d

Browse files
committed
Polishing
1 parent 214fa9c commit 8c07c6d

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

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

Lines changed: 21 additions & 11 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 {
@@ -213,9 +214,9 @@ private String propertyNameFor(Method method) {
213214

214215

215216
/**
216-
* Return the set of {@link PropertyDescriptor}s from the wrapped {@link BeanInfo}
217-
* object as well as {@code PropertyDescriptor}s for each non-void returning setter
218-
* method found during construction.
217+
* Return the set of {@link PropertyDescriptor PropertyDescriptors} from the wrapped
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
@@ -259,6 +260,9 @@ public MethodDescriptor[] getMethodDescriptors() {
259260
}
260261

261262

263+
/**
264+
* A simple {@link PropertyDescriptor}.
265+
*/
262266
static class SimplePropertyDescriptor extends PropertyDescriptor {
263267

264268
@Nullable
@@ -278,7 +282,9 @@ public SimplePropertyDescriptor(PropertyDescriptor original) throws Introspectio
278282
PropertyDescriptorUtils.copyNonMethodProperties(original, this);
279283
}
280284

281-
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+
282288
super(propertyName, null, null);
283289
this.readMethod = readMethod;
284290
this.writeMethod = writeMethod;
@@ -350,6 +356,9 @@ public String toString() {
350356
}
351357

352358

359+
/**
360+
* A simple {@link IndexedPropertyDescriptor}.
361+
*/
353362
static class SimpleIndexedPropertyDescriptor extends IndexedPropertyDescriptor {
354363

355364
@Nullable
@@ -379,8 +388,9 @@ public SimpleIndexedPropertyDescriptor(IndexedPropertyDescriptor original) throw
379388
PropertyDescriptorUtils.copyNonMethodProperties(original, this);
380389
}
381390

382-
public SimpleIndexedPropertyDescriptor(String propertyName, @Nullable Method readMethod, @Nullable Method writeMethod,
383-
@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 {
384394

385395
super(propertyName, null, null, null, null);
386396
this.readMethod = readMethod;

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,14 +30,12 @@
3030
* @author Chris Beams
3131
* @author Juergen Hoeller
3232
*/
33-
class PropertyDescriptorUtils {
33+
abstract class PropertyDescriptorUtils {
3434

3535
/**
3636
* See {@link java.beans.FeatureDescriptor}.
3737
*/
38-
public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDescriptor target)
39-
throws IntrospectionException {
40-
38+
public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDescriptor target) {
4139
target.setExpert(source.isExpert());
4240
target.setHidden(source.isHidden());
4341
target.setPreferred(source.isPreferred());

spring-core/src/main/java/org/springframework/core/SpringVersion.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
2525
* <p>Note that some ClassLoaders do not expose the package metadata,
2626
* hence this class might not be able to determine the Spring version
2727
* in all environments. Consider using a reflection-based check instead:
28-
* For example, checking for the presence of a specific Spring 2.0
28+
* For example, checking for the presence of a specific Spring 5.0
2929
* method that you intend to call.
3030
*
3131
* @author Juergen Hoeller

0 commit comments

Comments
 (0)