constructor argument type matching supports arrays and simple class names now (SPR-5844)

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1547 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Juergen Hoeller
2009-07-16 11:25:52 +00:00
parent 05215c7d5b
commit acd0fb7199
4 changed files with 72 additions and 3 deletions
@@ -542,6 +542,17 @@ public abstract class ClassUtils {
}
}
/**
* Check whether the given class matches the user-specified type name.
* @param clazz the class to check
* @param typeName the type name to match
*/
public static boolean matchesTypeName(Class clazz, String typeName) {
return (typeName != null &&
(typeName.equals(clazz.getName()) || typeName.equals(clazz.getSimpleName()) ||
(clazz.isArray() && typeName.equals(getQualifiedNameForArray(clazz)))));
}
/**
* Determine whether the given class has a constructor with the given signature.
@@ -806,6 +817,7 @@ public abstract class ClassUtils {
* @return the corresponding fully qualified class name
*/
public static String convertResourcePathToClassName(String resourcePath) {
Assert.notNull(resourcePath, "Resource path must not be null");
return resourcePath.replace('/', '.');
}
@@ -815,6 +827,7 @@ public abstract class ClassUtils {
* @return the corresponding resource path, pointing to the class
*/
public static String convertClassNameToResourcePath(String className) {
Assert.notNull(className, "Class name must not be null");
return className.replace('.', '/');
}