The list of methods to do Reflection Constructor Get are organized into topic(s).
Constructor
getConstructor(Class clazz, Class[] argTypes) get Constructor
if (clazz == null || argTypes == null) {
throw new IllegalArgumentException();
try {
return clazz.getConstructor(argTypes);
} catch (NoSuchMethodException e) {
return null;
Constructor
getConstructor(Class clz, Class expectedTypes[]) get Constructor
Constructor constructor = null;
try {
Constructor constructors[] = clz.getConstructors();
for (int i = 0; i < constructors.length; i++) {
Constructor creator = constructors[i];
if (isAssignable(expectedTypes, creator.getParameterTypes()))
if (constructor == null)
constructor = creator;
...
Constructor
getConstructor(Class type, Class[] argTypes) Returns a Constructor for the given method signature, or
null if no such
Constructor can be found.
if (null == type || null == argTypes) {
throw new NullPointerException();
Constructor ctor = null;
try {
ctor = type.getConstructor(argTypes);
} catch (Exception e) {
ctor = null;
...
Constructor>
getConstructor(Class> c, Class>[] args) Answer the constructor of the class
c which takes arguments of the type(s) in
args, or
null if there isn't one.
try {
return c.getConstructor(args);
} catch (NoSuchMethodException e) {
return null;