MCPcopy Index your code
hub / github.com/apache/tomcat / forName

Method forName

java/org/apache/el/util/ReflectionUtil.java:63–78  ·  view source on GitHub ↗

Loads a class by name, supporting primitive types and array notation. @param name the class name to load @return the Class object, or null if the name is empty @throws ClassNotFoundException if the class cannot be found

(String name)

Source from the content-addressed store, hash-verified

61 * @throws ClassNotFoundException if the class cannot be found
62 */
63 public static Class<?> forName(String name) throws ClassNotFoundException {
64 if (null == name || name.isEmpty()) {
65 return null;
66 }
67 Class<?> c = forNamePrimitive(name);
68 if (c == null) {
69 if (name.endsWith("[]")) {
70 String nc = name.substring(0, name.length() - 2);
71 c = Class.forName(nc, true, Thread.currentThread().getContextClassLoader());
72 c = Array.newInstance(c, 0).getClass();
73 } else {
74 c = Class.forName(name, true, Thread.currentThread().getContextClassLoader());
75 }
76 }
77 return c;
78 }
79
80 /**
81 * Looks up a primitive class by name.

Callers 15

readExternalMethod · 0.95
readExternalMethod · 0.95
readExternalMethod · 0.95
readExternalMethod · 0.95
getMethodMethod · 0.95
toTypeArrayMethod · 0.95
createComparatorMethod · 0.80
loadClassMethod · 0.80
initOpenSSLMethod · 0.80
getCharsetMethod · 0.80
openMethod · 0.80

Calls 5

forNamePrimitiveMethod · 0.95
endsWithMethod · 0.80
lengthMethod · 0.80
newInstanceMethod · 0.65
isEmptyMethod · 0.45

Tested by 14

createComparatorMethod · 0.64
initOpenSSLMethod · 0.64
getCharsetMethod · 0.64
openMethod · 0.64
openMethod · 0.64
doGetMethod · 0.64
doTestGetReaderMethod · 0.64
openMethod · 0.64
createChannelMethod · 0.64
DerbyDataSourceMethod · 0.64
testStoreMethod · 0.64