Here you can find the source of getConstructorWithNoParams(Class clazz)
private static Constructor getConstructorWithNoParams(Class clazz)
//package com.java2s; /*//from ww w . j a v a2 s . c o m * Copyright 2012 Red Hat, Inc. and/or its affiliates. * * Licensed under the Eclipse Public License version 1.0, available at * http://www.eclipse.org/legal/epl-v10.html */ import java.lang.reflect.Constructor; import java.lang.reflect.Modifier; public class Main { private static Constructor getConstructorWithNoParams(Class clazz) { for (Constructor constructor : clazz.getConstructors()) { if (constructor.getParameterTypes().length == 0) { if (Modifier.isPrivate(constructor.getModifiers()) || Modifier.isProtected(constructor.getModifiers())) { constructor.setAccessible(true); } return constructor; } } return null; } }