Here you can find the source of getConstructor(Class> clazz, boolean declared, Class>... args)
public static Constructor<?> getConstructor(Class<?> clazz, boolean declared, Class<?>... args)
//package com.java2s; //License from project: LGPL import java.lang.reflect.Constructor; public class Main { public static Constructor<?> getConstructor(Class<?> clazz, boolean declared, Class<?>... args) { try {/*from w ww. j a v a2 s .co m*/ Constructor<?> constructor = null; if (declared) { constructor = clazz.getDeclaredConstructor(args); constructor.setAccessible(true); } else constructor = clazz.getConstructor(args); return constructor; } catch (Throwable error) { return null; } } }