public class ClassLoader
extends java.lang.Object
Helper class for working with class loaders.
Constructor and Description |
---|
ClassLoader() |
public static java.lang.Class getClass(java.lang.String pName) throws java.lang.ClassNotFoundException
Loads a class with the given name. First attempts to use the context class loader, then its own class loader.
pName
- The fully qualified name of the class being loaded.pName
.java.lang.ClassNotFoundException
- Loading the class failed.public static java.lang.Class getClass(java.lang.String pName, java.lang.Class pAssignableTo) throws java.lang.ClassNotFoundException
Loads a class with the given name using getClass(String)
.
If an instance of the returned class cannot be assigned to the
class or interface pAssignableTo
, throws an
IllegalArgumentException.
java.lang.ClassNotFoundException
- The class with the name pName
could not be loaded.java.lang.IllegalArgumentException
- Instances of the class with the name
pName
are not assignable to the interface or class
pAssignableTo
.