public static Constructor < ? > [ ] getAnnotatedDeclaredConstructors ( Class < ? > clazz , Class < ? extends Annotation > annotationClass , boolean recursively ) { Constructor < ? > [ ] allConstructors = getDeclaredConstructors ( clazz , recursively ) ; List < Constructor < ? > > annotatedConstructors = new LinkedList < Constructor < ? > > ( ) ; for ( Constructor < ? > field : allConstructors ) { if ( field . isAnnotationPresent ( annotationClass ) ) annotatedConstructors . add ( field ) ; } return annotatedConstructors . toArray ( new Constructor < ? > [ annotatedConstructors . size ( ) ] ) ; }
obtain constructors list of specified class and which are annotated by incoming annotation class If recursively is true obtain constructors from all class hierarchy