Modifier and Type | Method and Description |
---|---|
static boolean |
classExists(String implClassName) |
static <T> Class<T> |
loadClass(String className) |
static <T> Class<? extends T> |
loadClass(String className,
Class<T> superClass) |
static <T> T |
loadInstanceOf(Class<T> clazz)
Like
loadInstanceOf(String, Class) where the reference returned is of the same type as
the class being loaded -- not any supertype. |
static <T> T |
loadInstanceOf(String implClassName,
Class<T> superClass)
Like
loadInstanceOf(String, Class, Class[], Object[]) for no-arg constructors. |
static <T> T |
loadInstanceOf(String implClassName,
Class<T> superClass,
Class<?>[] constructorTypes,
Object[] constructorArgs)
Loads and instantiates a named implementation class, a subclass of a given supertype,
whose constructor takes the given arguments.
|
public static boolean classExists(String implClassName)
implClassName
- class name to texttrue
if the class exists in the JVM and can be loadedpublic static <T> T loadInstanceOf(Class<T> clazz)
loadInstanceOf(String, Class)
where the reference returned is of the same type as
the class being loaded -- not any supertype.T
- type of returned instanceclazz
- Class
to make an instance ofclazz
public static <T> T loadInstanceOf(String implClassName, Class<T> superClass)
loadInstanceOf(String, Class, Class[], Object[])
for no-arg constructors.T
- type of returned instanceimplClassName
- implementation class namesuperClass
- superclass or interface that the implementation extendsimplClassName
public static <T> T loadInstanceOf(String implClassName, Class<T> superClass, Class<?>[] constructorTypes, Object[] constructorArgs)
T
- type of returned instanceimplClassName
- implementation class namesuperClass
- superclass or interface that the implementation extendsconstructorTypes
- argument types of constructor to useconstructorArgs
- actual constructor argumentsimplClassName
Copyright © 2014–2018. All rights reserved.