Here you can find the source of getConstructor(Class
public static <T> Constructor<T> getConstructor(Class<T> instanceType)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Constructor; import java.lang.reflect.Modifier; public class Main { public static <T> Constructor<T> getConstructor(Class<T> instanceType) { Constructor<?>[] constructors = instanceType.getConstructors(); for (Constructor<?> constructor : constructors) { if (constructor.getModifiers() == Modifier.PUBLIC) { return (Constructor<T>) constructor; }//from w w w . j a v a2 s . c o m } return null; } }