Here you can find the source of getConstructor(Class> clazz, Class>... params)
Parameter | Description |
---|---|
clazz | The class |
params | The Constructor parameters |
@SuppressWarnings("unused") @Nullable public static Constructor<?> getConstructor(Class<?> clazz, Class<?>... params)
//package com.java2s; //License from project: Open Source License import javax.annotation.Nullable; import java.lang.reflect.Constructor; public class Main { /**/*from w w w . ja v a2s .com*/ * Returns the constructor * * @param clazz The class * @param params The Constructor parameters * * @return The Constructor or null if there is none with these parameters */ @SuppressWarnings("unused") @Nullable public static Constructor<?> getConstructor(Class<?> clazz, Class<?>... params) { try { return clazz.getConstructor(params); } catch (NoSuchMethodException e) { return null; } } }