mirror of
https://github.com/corda/corda.git
synced 2025-01-23 12:58:35 +00:00
optionally specify classloader to Class.forCanonicalName
This commit is contained in:
parent
1a2deff97d
commit
97ea23e3bb
@ -136,11 +136,15 @@ public final class Class <T> implements Type, GenericDeclaration {
|
||||
private native void initialize();
|
||||
|
||||
public static Class forCanonicalName(String name) {
|
||||
return forCanonicalName(null, name);
|
||||
}
|
||||
|
||||
public static Class forCanonicalName(ClassLoader loader, String name) {
|
||||
try {
|
||||
if (name.startsWith("[")) {
|
||||
return forName(name);
|
||||
return forName(name, true, loader);
|
||||
} else if (name.startsWith("L")) {
|
||||
return forName(name.substring(1, name.length() - 1));
|
||||
return forName(name.substring(1, name.length() - 1), true, loader);
|
||||
} else {
|
||||
if (name.length() == 1) {
|
||||
return primitiveClass(name.charAt(0));
|
||||
|
Loading…
Reference in New Issue
Block a user