public class PrimitiveClassLoaderUtil extends Object
loadClass(String, ClassLoader)
to centralize the logic of checking for primitive types to ensure that
the ClassLoader.loadClass(String) method is not invoked for primitives.| Constructor and Description |
|---|
PrimitiveClassLoaderUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Class<?> |
loadClass(String name,
ClassLoader cl)
First checks if
name is a primitive type. |
public static Class<?> loadClass(String name, ClassLoader cl) throws ClassNotFoundException
name is a primitive type. If yes, then returns
the corresponding Class for that primitive. If it's not a primitive
then the Class.forName(String, boolean, ClassLoader) method is invoked, passing
it the name, false and the cl classloadername - The class that has to be loadedcl - The ClassLoader to use, if name is *not* a primitiveClass corresponding to nameClassNotFoundException - If the class for name could not be foundClassLoader.loadClass(String)Copyright © 2020 JBoss by Red Hat. All rights reserved.