diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/propertyeditors/ClassArrayEditor.java b/org.springframework.beans/src/main/java/org/springframework/beans/propertyeditors/ClassArrayEditor.java
index ab8e93b48db..4db48197f8e 100644
--- a/org.springframework.beans/src/main/java/org/springframework/beans/propertyeditors/ClassArrayEditor.java
+++ b/org.springframework.beans/src/main/java/org/springframework/beans/propertyeditors/ClassArrayEditor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.springframework.beans.propertyeditors;
import java.beans.PropertyEditorSupport;
import org.springframework.util.ClassUtils;
+import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
/**
@@ -30,6 +31,7 @@ import org.springframework.util.StringUtils;
* to the standard {@link Class#forName(String)} method.
*
* @author Rob Harrop
+ * @author Juergen Hoeller
* @since 2.0
*/
public class ClassArrayEditor extends PropertyEditorSupport {
@@ -52,8 +54,7 @@ public class ClassArrayEditor extends PropertyEditorSupport {
* (or pass null for the thread context ClassLoader)
*/
public ClassArrayEditor(ClassLoader classLoader) {
- this.classLoader = classLoader != null
- ? classLoader : ClassUtils.getDefaultClassLoader();
+ this.classLoader = (classLoader != null ? classLoader : ClassUtils.getDefaultClassLoader());
}
@@ -76,14 +77,9 @@ public class ClassArrayEditor extends PropertyEditorSupport {
@Override
public String getAsText() {
Class[] classes = (Class[]) getValue();
- if (classes == null || classes.length == 0) {
+ if (ObjectUtils.isEmpty(classes)) {
return "";
}
- return toCommaDelimitedString(classes);
- }
-
-
- private static String toCommaDelimitedString(Class[] classes) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < classes.length; ++i) {
if (i > 0) {
diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/propertyeditors/ClassEditor.java b/org.springframework.beans/src/main/java/org/springframework/beans/propertyeditors/ClassEditor.java
index afdc6ec69c5..4f5fffce466 100644
--- a/org.springframework.beans/src/main/java/org/springframework/beans/propertyeditors/ClassEditor.java
+++ b/org.springframework.beans/src/main/java/org/springframework/beans/propertyeditors/ClassEditor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,8 +53,7 @@ public class ClassEditor extends PropertyEditorSupport {
* (or null for the thread context ClassLoader)
*/
public ClassEditor(ClassLoader classLoader) {
- this.classLoader =
- (classLoader != null ? classLoader : ClassUtils.getDefaultClassLoader());
+ this.classLoader = (classLoader != null ? classLoader : ClassUtils.getDefaultClassLoader());
}
diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/support/ResourceEditorRegistrar.java b/org.springframework.beans/src/main/java/org/springframework/beans/support/ResourceEditorRegistrar.java
index 6dee35cb291..3c61d853506 100644
--- a/org.springframework.beans/src/main/java/org/springframework/beans/support/ResourceEditorRegistrar.java
+++ b/org.springframework.beans/src/main/java/org/springframework/beans/support/ResourceEditorRegistrar.java
@@ -27,6 +27,7 @@ import org.xml.sax.InputSource;
import org.springframework.beans.PropertyEditorRegistrar;
import org.springframework.beans.PropertyEditorRegistry;
import org.springframework.beans.PropertyEditorRegistrySupport;
+import org.springframework.beans.propertyeditors.ClassArrayEditor;
import org.springframework.beans.propertyeditors.ClassEditor;
import org.springframework.beans.propertyeditors.FileEditor;
import org.springframework.beans.propertyeditors.InputSourceEditor;
@@ -89,8 +90,9 @@ public class ResourceEditorRegistrar implements PropertyEditorRegistrar {
doRegisterEditor(registry, URL.class, new URLEditor(baseEditor));
ClassLoader classLoader = this.resourceLoader.getClassLoader();
- doRegisterEditor(registry, Class.class, new ClassEditor(classLoader));
doRegisterEditor(registry, URI.class, new URIEditor(classLoader));
+ doRegisterEditor(registry, Class.class, new ClassEditor(classLoader));
+ doRegisterEditor(registry, Class[].class, new ClassArrayEditor(classLoader));
if (this.resourceLoader instanceof ResourcePatternResolver) {
doRegisterEditor(registry, Resource[].class,