File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
main/java/org/springframework/beans
test/java/org/springframework/beans Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 16
16
17
17
package org .springframework .beans ;
18
18
19
+ import java .beans .BeanDescriptor ;
19
20
import java .beans .BeanInfo ;
20
21
import java .beans .IntrospectionException ;
21
22
import java .beans .PropertyDescriptor ;
@@ -51,6 +52,10 @@ public BeanInfo getBeanInfo(Class<?> beanClass) throws IntrospectionException {
51
52
PropertyDescriptorUtils .determineBasicProperties (beanClass );
52
53
53
54
return new SimpleBeanInfo () {
55
+ @ Override
56
+ public BeanDescriptor getBeanDescriptor () {
57
+ return new BeanDescriptor (beanClass );
58
+ }
54
59
@ Override
55
60
public PropertyDescriptor [] getPropertyDescriptors () {
56
61
return pds .toArray (PropertyDescriptorUtils .EMPTY_PROPERTY_DESCRIPTOR_ARRAY );
Original file line number Diff line number Diff line change @@ -77,6 +77,21 @@ void aliasedSetterThroughDefaultMethod() {
77
77
assertThat (accessor .getPropertyValue ("aliasedName" )).isEqualTo ("tom" );
78
78
}
79
79
80
+ @ Test
81
+ void replaceWrappedInstance () {
82
+ GetterBean target = new GetterBean ();
83
+ BeanWrapperImpl accessor = createAccessor (target );
84
+ accessor .setPropertyValue ("name" , "tom" );
85
+ assertThat (target .getAliasedName ()).isEqualTo ("tom" );
86
+ assertThat (accessor .getPropertyValue ("aliasedName" )).isEqualTo ("tom" );
87
+
88
+ target = new GetterBean ();
89
+ accessor .setWrappedInstance (target );
90
+ accessor .setPropertyValue ("name" , "tom" );
91
+ assertThat (target .getAliasedName ()).isEqualTo ("tom" );
92
+ assertThat (accessor .getPropertyValue ("aliasedName" )).isEqualTo ("tom" );
93
+ }
94
+
80
95
@ Test
81
96
void setValidAndInvalidPropertyValuesShouldContainExceptionDetails () {
82
97
TestBean target = new TestBean ();
You can’t perform that action at this time.
0 commit comments