git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@739041 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Matthew Jason Benson 2009-01-29 22:00:55 +00:00
parent 10e6a671fc
commit 00fee20efc
1 changed files with 11 additions and 12 deletions

View File

@ -621,8 +621,8 @@ public static Class[] primitivesToWrappers(Class[] classes) {
}
Class[] convertedClasses = new Class[classes.length];
for (int i=0; i < classes.length; i++) {
convertedClasses[i] = primitiveToWrapper( classes[i] );
for (int i = 0; i < classes.length; i++) {
convertedClasses[i] = primitiveToWrapper(classes[i]);
}
return convertedClasses;
}
@ -671,8 +671,8 @@ public static Class[] wrappersToPrimitives(Class[] classes) {
}
Class[] convertedClasses = new Class[classes.length];
for (int i=0; i < classes.length; i++) {
convertedClasses[i] = wrapperToPrimitive( classes[i] );
for (int i = 0; i < classes.length; i++) {
convertedClasses[i] = wrapperToPrimitive(classes[i]);
}
return convertedClasses;
}
@ -734,7 +734,7 @@ public static Class getClass(ClassLoader classLoader, String className) throws C
}
/**
* Returns the (initialized )class represented by <code>className</code>
* Returns the (initialized) class represented by <code>className</code>
* using the current thread's context class loader. This implementation
* supports names like "<code>java.lang.String[]</code>" as well as
* "<code>[Ljava.lang.String;</code>".
@ -856,8 +856,7 @@ private static String toCanonicalName(String className) {
* @return a <code>Class</code> array, <code>null</code> if null array input
* @since 2.4
*/
public static Class[] toClass(Object[] array)
{
public static Class[] toClass(Object[] array) {
if (array == null) {
return null;
} else if (array.length == 0) {
@ -981,27 +980,27 @@ private static String getCanonicalName(String className) {
return null;
} else {
int dim = 0;
while(className.startsWith("[")) {
while (className.startsWith("[")) {
dim++;
className = className.substring(1);
}
if(dim < 1) {
if (dim < 1) {
return className;
} else {
if(className.startsWith("L")) {
if (className.startsWith("L")) {
className = className.substring(
1,
className.endsWith(";")
? className.length() - 1
: className.length());
} else {
if(className.length() > 0) {
if (className.length() > 0) {
className = (String) reverseAbbreviationMap.get(
className.substring(0, 1));
}
}
StringBuffer canonicalClassNameBuffer = new StringBuffer(className);
for(int i = 0; i < dim; i++) {
for (int i = 0; i < dim; i++) {
canonicalClassNameBuffer.append("[]");
}
return canonicalClassNameBuffer.toString();