Java Reflection Constructor Get getConstructor(Class clazz, Class... parameterTypes)

Here you can find the source of getConstructor(Class clazz, Class... parameterTypes)

Description

Fail-safe.

License

Open Source License

Parameter

Parameter Description
clazz a parameter
parameterTypes a parameter

Return

null on errors.

Declaration

public static Constructor<?> getConstructor(Class<?> clazz, Class<?>... parameterTypes) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.lang.reflect.Constructor;

public class Main {
    /**//from  w  ww. j a  va2  s  .  co m
     * Fail-safe.
     * @param clazz
     * @param parameterTypes
     * @return null on errors.
     */
    public static Constructor<?> getConstructor(Class<?> clazz, Class<?>... parameterTypes) {
        try {
            return clazz.getConstructor(parameterTypes);
        } catch (NoSuchMethodException e) {
        } catch (SecurityException e) {
        }
        return null;
    }
}

Related

  1. getConstructor(Class c, Class[] args)
  2. getConstructor(Class clazz, boolean declared, Class... args)
  3. getConstructor(Class clazz, Class... args)
  4. getConstructor(Class clazz, Class... args)
  5. getConstructor(Class clazz, Class... parameterTypes)
  6. getConstructor(Class clazz, Class... params)
  7. getConstructor(Class clazz, Class... params)
  8. getConstructor(Class clazz, Object... args)
  9. getConstructor(Class clazz, Object[] parameters)