Consistent abstract declaration for utility classes (plus polishing)

Issue: SPR-16968
This commit is contained in:
Juergen Hoeller
2018-07-01 02:31:20 +02:00
parent e72f4ec501
commit 4ff1e3e74b
21 changed files with 31 additions and 77 deletions

View File

@@ -43,8 +43,10 @@ import org.springframework.util.ObjectUtils;
* Decorator for a standard {@link BeanInfo} object, e.g. as created by
* {@link Introspector#getBeanInfo(Class)}, designed to discover and register static
* and/or non-void returning setter methods. For example:
*
* <pre class="code">
* public class Bean {
*
* private Foo foo;
*
* public Foo getFoo() {
@@ -56,6 +58,7 @@ import org.springframework.util.ObjectUtils;
* return this;
* }
* }</pre>
*
* The standard JavaBeans {@code Introspector} will discover the {@code getFoo} read
* method, but will bypass the {@code #setFoo(Foo)} write method, because its non-void
* returning signature does not comply with the JavaBeans specification.
@@ -68,6 +71,7 @@ import org.springframework.util.ObjectUtils;
* indexed properties</a> are fully supported.
*
* @author Chris Beams
* @author Juergen Hoeller
* @since 3.1
* @see #ExtendedBeanInfo(BeanInfo)
* @see ExtendedBeanInfoFactory
@@ -79,8 +83,7 @@ class ExtendedBeanInfo implements BeanInfo {
private final BeanInfo delegate;
private final Set<PropertyDescriptor> propertyDescriptors =
new TreeSet<>(new PropertyDescriptorComparator());
private final Set<PropertyDescriptor> propertyDescriptors = new TreeSet<>(new PropertyDescriptorComparator());
/**
@@ -91,11 +94,9 @@ class ExtendedBeanInfo implements BeanInfo {
* through its method descriptors to find any non-void returning write methods and
* update or create the corresponding {@link PropertyDescriptor} for each one found.
* @param delegate the wrapped {@code BeanInfo}, which is never modified
* @throws IntrospectionException if any problems occur creating and adding new
* property descriptors
* @see #getPropertyDescriptors()
*/
public ExtendedBeanInfo(BeanInfo delegate) throws IntrospectionException {
public ExtendedBeanInfo(BeanInfo delegate) {
this.delegate = delegate;
for (PropertyDescriptor pd : delegate.getPropertyDescriptors()) {
try {
@@ -214,8 +215,8 @@ class ExtendedBeanInfo implements BeanInfo {
/**
* Return the set of {@link PropertyDescriptor PropertyDescriptors} from the wrapped
* {@link BeanInfo} object as well as {@code PropertyDescriptor BeanInfo} object as well as {@code PropertyDescriptors}
* for each non-void returning setter method found during construction.
* {@link BeanInfo} object as well as {@code PropertyDescriptors} for each non-void
* returning setter method found during construction.
* @see #ExtendedBeanInfo(BeanInfo)
*/
@Override
@@ -281,7 +282,9 @@ class ExtendedBeanInfo implements BeanInfo {
PropertyDescriptorUtils.copyNonMethodProperties(original, this);
}
public SimplePropertyDescriptor(String propertyName, @Nullable Method readMethod, Method writeMethod) throws IntrospectionException {
public SimplePropertyDescriptor(String propertyName, @Nullable Method readMethod, Method writeMethod)
throws IntrospectionException {
super(propertyName, null, null);
this.readMethod = readMethod;
this.writeMethod = writeMethod;
@@ -385,8 +388,9 @@ class ExtendedBeanInfo implements BeanInfo {
PropertyDescriptorUtils.copyNonMethodProperties(original, this);
}
public SimpleIndexedPropertyDescriptor(String propertyName, @Nullable Method readMethod, @Nullable Method writeMethod,
@Nullable Method indexedReadMethod, Method indexedWriteMethod) throws IntrospectionException {
public SimpleIndexedPropertyDescriptor(String propertyName, @Nullable Method readMethod,
@Nullable Method writeMethod, @Nullable Method indexedReadMethod, Method indexedWriteMethod)
throws IntrospectionException {
super(propertyName, null, null, null, null);
this.readMethod = readMethod;

View File

@@ -30,19 +30,12 @@ import org.springframework.util.ObjectUtils;
* @author Chris Beams
* @author Juergen Hoeller
*/
final class PropertyDescriptorUtils {
private PropertyDescriptorUtils() {
}
abstract class PropertyDescriptorUtils {
/**
* See {@link java.beans.FeatureDescriptor}.
*/
public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDescriptor target)
throws IntrospectionException {
public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDescriptor target) {
target.setExpert(source.isExpert());
target.setHidden(source.isHidden());
target.setPreferred(source.isPreferred());

View File

@@ -35,7 +35,7 @@ import org.springframework.util.StringUtils;
* @see PropertiesBeanDefinitionReader
* @see org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader
*/
public final class BeanDefinitionReaderUtils {
public abstract class BeanDefinitionReaderUtils {
/**
* Separator for generated bean names. If a class name or parent name is not
@@ -44,10 +44,6 @@ public final class BeanDefinitionReaderUtils {
public static final String GENERATED_BEAN_NAME_SEPARATOR = BeanFactoryUtils.GENERATED_BEAN_NAME_SEPARATOR;
private BeanDefinitionReaderUtils() {
}
/**
* Create a new GenericBeanDefinition for the given parent name and class name,
* eagerly loading the bean class if a ClassLoader has been specified.