43
43
* Decorator for a standard {@link BeanInfo} object, e.g. as created by
44
44
* {@link Introspector#getBeanInfo(Class)}, designed to discover and register static
45
45
* and/or non-void returning setter methods. For example:
46
+ *
46
47
* <pre class="code">
47
48
* public class Bean {
49
+ *
48
50
* private Foo foo;
49
51
*
50
52
* public Foo getFoo() {
56
58
* return this;
57
59
* }
58
60
* }</pre>
61
+ *
59
62
* The standard JavaBeans {@code Introspector} will discover the {@code getFoo} read
60
63
* method, but will bypass the {@code #setFoo(Foo)} write method, because its non-void
61
64
* returning signature does not comply with the JavaBeans specification.
68
71
* indexed properties</a> are fully supported.
69
72
*
70
73
* @author Chris Beams
74
+ * @author Juergen Hoeller
71
75
* @since 3.1
72
76
* @see #ExtendedBeanInfo(BeanInfo)
73
77
* @see ExtendedBeanInfoFactory
@@ -79,8 +83,7 @@ class ExtendedBeanInfo implements BeanInfo {
79
83
80
84
private final BeanInfo delegate ;
81
85
82
- private final Set <PropertyDescriptor > propertyDescriptors =
83
- new TreeSet <>(new PropertyDescriptorComparator ());
86
+ private final Set <PropertyDescriptor > propertyDescriptors = new TreeSet <>(new PropertyDescriptorComparator ());
84
87
85
88
86
89
/**
@@ -91,11 +94,9 @@ class ExtendedBeanInfo implements BeanInfo {
91
94
* through its method descriptors to find any non-void returning write methods and
92
95
* update or create the corresponding {@link PropertyDescriptor} for each one found.
93
96
* @param delegate the wrapped {@code BeanInfo}, which is never modified
94
- * @throws IntrospectionException if any problems occur creating and adding new
95
- * property descriptors
96
97
* @see #getPropertyDescriptors()
97
98
*/
98
- public ExtendedBeanInfo (BeanInfo delegate ) throws IntrospectionException {
99
+ public ExtendedBeanInfo (BeanInfo delegate ) {
99
100
this .delegate = delegate ;
100
101
for (PropertyDescriptor pd : delegate .getPropertyDescriptors ()) {
101
102
try {
@@ -213,9 +214,9 @@ private String propertyNameFor(Method method) {
213
214
214
215
215
216
/**
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.
219
220
* @see #ExtendedBeanInfo(BeanInfo)
220
221
*/
221
222
@ Override
@@ -259,6 +260,9 @@ public MethodDescriptor[] getMethodDescriptors() {
259
260
}
260
261
261
262
263
+ /**
264
+ * A simple {@link PropertyDescriptor}.
265
+ */
262
266
static class SimplePropertyDescriptor extends PropertyDescriptor {
263
267
264
268
@ Nullable
@@ -278,7 +282,9 @@ public SimplePropertyDescriptor(PropertyDescriptor original) throws Introspectio
278
282
PropertyDescriptorUtils .copyNonMethodProperties (original , this );
279
283
}
280
284
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
+
282
288
super (propertyName , null , null );
283
289
this .readMethod = readMethod ;
284
290
this .writeMethod = writeMethod ;
@@ -350,6 +356,9 @@ public String toString() {
350
356
}
351
357
352
358
359
+ /**
360
+ * A simple {@link IndexedPropertyDescriptor}.
361
+ */
353
362
static class SimpleIndexedPropertyDescriptor extends IndexedPropertyDescriptor {
354
363
355
364
@ Nullable
@@ -379,8 +388,9 @@ public SimpleIndexedPropertyDescriptor(IndexedPropertyDescriptor original) throw
379
388
PropertyDescriptorUtils .copyNonMethodProperties (original , this );
380
389
}
381
390
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 {
384
394
385
395
super (propertyName , null , null , null , null );
386
396
this .readMethod = readMethod ;
0 commit comments