Browse Source

Precompute PropertyDescriptor array in SimpleBeanInfoFactory

Closes gh-36112
pull/36115/head
Sam Brannen 3 weeks ago
parent
commit
992ae2ea6b
  1. 7
      spring-beans/src/main/java/org/springframework/beans/SimpleBeanInfoFactory.java

7
spring-beans/src/main/java/org/springframework/beans/SimpleBeanInfoFactory.java

@ -21,7 +21,6 @@ import java.beans.BeanInfo; @@ -21,7 +21,6 @@ import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.beans.SimpleBeanInfo;
import java.util.Collection;
import org.springframework.core.Ordered;
@ -48,8 +47,8 @@ class SimpleBeanInfoFactory implements BeanInfoFactory, Ordered { @@ -48,8 +47,8 @@ class SimpleBeanInfoFactory implements BeanInfoFactory, Ordered {
@Override
public BeanInfo getBeanInfo(Class<?> beanClass) throws IntrospectionException {
Collection<? extends PropertyDescriptor> pds =
PropertyDescriptorUtils.determineBasicProperties(beanClass);
PropertyDescriptor[] pds = PropertyDescriptorUtils.determineBasicProperties(beanClass)
.toArray(PropertyDescriptorUtils.EMPTY_PROPERTY_DESCRIPTOR_ARRAY);
return new SimpleBeanInfo() {
@Override
@ -58,7 +57,7 @@ class SimpleBeanInfoFactory implements BeanInfoFactory, Ordered { @@ -58,7 +57,7 @@ class SimpleBeanInfoFactory implements BeanInfoFactory, Ordered {
}
@Override
public PropertyDescriptor[] getPropertyDescriptors() {
return pds.toArray(PropertyDescriptorUtils.EMPTY_PROPERTY_DESCRIPTOR_ARRAY);
return pds;
}
};
}

Loading…
Cancel
Save