public final class ReflectionUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
createInstance(Object source,
Class<T> base,
ClassLoader classLoader)
Creates or returns an instance of an arbitrary type which is a sub type
of given
base class. |
public static <T> T createInstance(Object source, Class<T> base, ClassLoader classLoader)
base class. If the source object already is an instance
of base, then it is returned. If the source object is a
Class object, its no-argument default constructor will be called
and the resulting object returned. If the source is a String it is taken
to be the full qualified name of a class which is then loaded using the
given ClassLoader prior to calling its default constructor.source - Either a String, a Class or a ready to use object.base - A super type of the object to create.classLoader - The ClassLoader that should be used to load the class
in case the source parameter is a String.TinyPlugzException - If anything goes wrong in the process
described above.Copyright © 2014–2015. All rights reserved.