public class ClassloadingUtility extends Object
Constructor and Description |
---|
ClassloadingUtility() |
Modifier and Type | Method and Description |
---|---|
static String |
getNameForClass(Object instance)
Reverse mapping - obtain the class name for a given Object.
|
static List<String> |
getNamesForClasses(List<? extends Object> instances)
Reverse mapping - obtain the class names from a given set of Objects.
|
static <T> T |
loadAndInstantiateClass(Class<T> iface,
String className,
String environmentBeanInstanceName)
Load, instantiate and return an instance of the named class, which is expected to be an implementation of
the specified interface.
|
static <T> List<T> |
loadAndInstantiateClasses(Class<T> iface,
List<String> classNames) |
static <T> List<T> |
loadAndInstantiateClassesWithInit(Class<T> iface,
List<String> classNamesWithOptionalInitParams) |
static <T> Class<? extends T> |
loadClass(Class<T> iface,
String className)
Load and return the named class, which is expected to be an implementation of the specified interface.
|
static Class |
loadClass(String className)
Load a class.
|
public static Class loadClass(String className)
className
- the name of the class to load and instantiate.public static <T> Class<? extends T> loadClass(Class<T> iface, String className)
iface
- the expected interface type.className
- the name of the class to load and instantiate.public static <T> T loadAndInstantiateClass(Class<T> iface, String className, String environmentBeanInstanceName)
iface
- the expected interface type.className
- the name of the class to load and instantiate.environmentBeanInstanceName
- When the class ctor requires a *EnvironmentBean instance, the name of the bean.
null for default ctor or default bean instance..public static <T> List<T> loadAndInstantiateClasses(Class<T> iface, List<String> classNames)
public static <T> List<T> loadAndInstantiateClassesWithInit(Class<T> iface, List<String> classNamesWithOptionalInitParams)
public static String getNameForClass(Object instance)
instance
- the Object of interestpublic static List<String> getNamesForClasses(List<? extends Object> instances)
instances
- a list of Objects of interest.Copyright © 2021 JBoss by Red Hat. All rights reserved.