mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-06 10:08:32 +00:00
ws
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@739041 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
10e6a671fc
commit
00fee20efc
@ -621,8 +621,8 @@ public static Class[] primitivesToWrappers(Class[] classes) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Class[] convertedClasses = new Class[classes.length];
|
Class[] convertedClasses = new Class[classes.length];
|
||||||
for (int i=0; i < classes.length; i++) {
|
for (int i = 0; i < classes.length; i++) {
|
||||||
convertedClasses[i] = primitiveToWrapper( classes[i] );
|
convertedClasses[i] = primitiveToWrapper(classes[i]);
|
||||||
}
|
}
|
||||||
return convertedClasses;
|
return convertedClasses;
|
||||||
}
|
}
|
||||||
@ -671,8 +671,8 @@ public static Class[] wrappersToPrimitives(Class[] classes) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Class[] convertedClasses = new Class[classes.length];
|
Class[] convertedClasses = new Class[classes.length];
|
||||||
for (int i=0; i < classes.length; i++) {
|
for (int i = 0; i < classes.length; i++) {
|
||||||
convertedClasses[i] = wrapperToPrimitive( classes[i] );
|
convertedClasses[i] = wrapperToPrimitive(classes[i]);
|
||||||
}
|
}
|
||||||
return convertedClasses;
|
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
|
* using the current thread's context class loader. This implementation
|
||||||
* supports names like "<code>java.lang.String[]</code>" as well as
|
* supports names like "<code>java.lang.String[]</code>" as well as
|
||||||
* "<code>[Ljava.lang.String;</code>".
|
* "<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
|
* @return a <code>Class</code> array, <code>null</code> if null array input
|
||||||
* @since 2.4
|
* @since 2.4
|
||||||
*/
|
*/
|
||||||
public static Class[] toClass(Object[] array)
|
public static Class[] toClass(Object[] array) {
|
||||||
{
|
|
||||||
if (array == null) {
|
if (array == null) {
|
||||||
return null;
|
return null;
|
||||||
} else if (array.length == 0) {
|
} else if (array.length == 0) {
|
||||||
@ -981,27 +980,27 @@ private static String getCanonicalName(String className) {
|
|||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
int dim = 0;
|
int dim = 0;
|
||||||
while(className.startsWith("[")) {
|
while (className.startsWith("[")) {
|
||||||
dim++;
|
dim++;
|
||||||
className = className.substring(1);
|
className = className.substring(1);
|
||||||
}
|
}
|
||||||
if(dim < 1) {
|
if (dim < 1) {
|
||||||
return className;
|
return className;
|
||||||
} else {
|
} else {
|
||||||
if(className.startsWith("L")) {
|
if (className.startsWith("L")) {
|
||||||
className = className.substring(
|
className = className.substring(
|
||||||
1,
|
1,
|
||||||
className.endsWith(";")
|
className.endsWith(";")
|
||||||
? className.length() - 1
|
? className.length() - 1
|
||||||
: className.length());
|
: className.length());
|
||||||
} else {
|
} else {
|
||||||
if(className.length() > 0) {
|
if (className.length() > 0) {
|
||||||
className = (String) reverseAbbreviationMap.get(
|
className = (String) reverseAbbreviationMap.get(
|
||||||
className.substring(0, 1));
|
className.substring(0, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StringBuffer canonicalClassNameBuffer = new StringBuffer(className);
|
StringBuffer canonicalClassNameBuffer = new StringBuffer(className);
|
||||||
for(int i = 0; i < dim; i++) {
|
for (int i = 0; i < dim; i++) {
|
||||||
canonicalClassNameBuffer.append("[]");
|
canonicalClassNameBuffer.append("[]");
|
||||||
}
|
}
|
||||||
return canonicalClassNameBuffer.toString();
|
return canonicalClassNameBuffer.toString();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user