Java Reflection Constructor Get getConstructors(Class clazz)

Here you can find the source of getConstructors(Class clazz)

Description

get Constructors

License

Open Source License

Declaration

public static List<Constructor<?>> getConstructors(Class<?> clazz) 

Method Source Code

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

import java.lang.reflect.Constructor;

import java.lang.reflect.Modifier;

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static List<Constructor<?>> getConstructors(Class<?> clazz) {
        List<Constructor<?>> lst = new ArrayList<Constructor<?>>();
        Constructor<?>[] cotrs = clazz.getDeclaredConstructors();
        for (Constructor<?> c : cotrs) {
            int im = c.getModifiers();
            if (!Modifier.isPublic(im))
                continue;
            lst.add(c);/*  w w w . j  a v a 2 s. c  o m*/
        }
        return lst;
    }
}

Related

  1. getConstructorLabel(java.lang.reflect.Constructor con)
  2. getConstructorOptional(Class cls, Class... argsTypes)
  3. getConstructorOrFail(Class clazz, Class... argTypes)
  4. getConstructors(Class cl)
  5. getConstructors(Class infoClass)
  6. getConstructors(Class clazz, int args)
  7. getConstructors(Class clazz)
  8. getConstructors(Class clazz, int modifier)
  9. getConstructors(final Class cl, final int params)