@SuppressWarnings({"unchecked"})
    public static <T> Constructor<T>[] collectConstructors(Class<T> clazz, int include, int exclude) {
        final List<Constructor<?>> result = new ArrayList<>();
        for (Constructor<?> c: clazz.getDeclaredConstructors()) {
            int mod = c.getModifiers();
            if (include(mod, include, exclude)) {
                result.add(c);
            }
        }
        return (Constructor<T>[]) result.toArray(new Constructor<?>[result.size()]);
    }
@ SuppressWarnings ( { "unchecked" } ) public static < T > Constructor < T > [ ] collectConstructors ( Class < T > clazz , int include , int exclude ) { final List < Constructor < ? > > result = new ArrayList < > ( ) ; for ( Constructor < ? > c : clazz . getDeclaredConstructors ( ) ) { int mod = c . getModifiers ( ) ; if ( include ( mod , include , exclude ) ) { result . add ( c ) ; } } return ( Constructor < T > [ ] ) result . toArray ( new Constructor < ? > [ result . size ( ) ] ) ; }
Collects constructors of {@code clazz}.
Constructors are included if their modifier bits match each bit of {@code include}
and no bit of {@code exclude}.
@param <T>
@param clazz
@param include
@param exclude
@return constructors