Here you can find the source of getConstructor(Class clazz, Class[] parametersTypes)
Parameter | Description |
---|---|
clazz | Class, which constructor will be returned. |
parametersTypes | Array of parameters types, that will be used for getting constructor. |
Parameter | Description |
---|---|
Exception | To JUnit. |
public static Constructor getConstructor(Class clazz, Class[] parametersTypes) throws Exception
//package com.java2s; import java.lang.reflect.Constructor; public class Main { /**/*from w ww .j a v a 2 s . co m*/ * Gets the constructor with specified parameter types. * * @param clazz Class, which constructor will be returned. * @param parametersTypes Array of parameters types, that will be used for getting constructor. * @return Constructor. * @throws Exception To JUnit. */ public static Constructor getConstructor(Class clazz, Class[] parametersTypes) throws Exception { return clazz.getDeclaredConstructor(parametersTypes); } }