public final class ReflectionUtils
extends java.lang.Object
| Constructor and Description |
|---|
ReflectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <V,A> boolean |
activateMethod(java.lang.Object object,
java.lang.String methodName,
V value,
A argumentClass) |
static <T> T |
createInstance(java.lang.String className,
java.lang.Class<T> interfaceClass)
Creates an instance from its name.
|
static <T,A> T |
createInstance(java.lang.String className,
java.lang.Class<T> interfaceClass,
java.lang.Class<A> argumentClass,
A argument)
Creates an instance from its name.
|
static <T> void |
loadComponents(java.lang.Class<T> clazz,
java.util.List<T> list,
java.util.Collection<AddTypeXmlElement> classNames)
Generic method that creates instances based on their names and adds them to a Collection
Note that the class does its 'best effort' to create an instance and will not fail the method
if an instance (or more) was failed to create.
|
public static <T> T createInstance(java.lang.String className,
java.lang.Class<T> interfaceClass)
T - The class type to createclassName - The class we create an instance ofinterfaceClass - The class' parent interface we wish to work withpublic static <T,A> T createInstance(java.lang.String className,
java.lang.Class<T> interfaceClass,
java.lang.Class<A> argumentClass,
A argument)
T - The class type to createA - The class type as the Ctor argumentclassName - The class we create an instance ofinterfaceClass - The class' parent interface we wish to work withargumentClass - Type of class to use as argument for Ctorargument - The argument to pass the Ctorpublic static <V,A> boolean activateMethod(java.lang.Object object,
java.lang.String methodName,
V value,
A argumentClass)
V - - Generic for value classA - - Generic for argument classobject - - The instance we work withmethodName - - The method to activatevalue - - The value to pass to the methodargumentClass - - The argument classpublic static <T> void loadComponents(java.lang.Class<T> clazz,
java.util.List<T> list,
java.util.Collection<AddTypeXmlElement> classNames)
T - The class type to createclazz - The class all instances should havelist - The container of instances, this is where we store our instances that we createclassNames - Classes to create.