private < T extends Element > void mapAnnotations ( final Map < TypeElement , List < T > > map , Element e , final T holder ) { new SimpleElementVisitor9 < Void , Void > ( ) { void addAnnotations ( Element e ) { for ( AnnotationMirror a : e . getAnnotationMirrors ( ) ) { add ( map , ( TypeElement ) a . getAnnotationType ( ) . asElement ( ) , holder ) ; } } @ Override public Void visitPackage ( PackageElement e , Void p ) { for ( AnnotationMirror a : e . getAnnotationMirrors ( ) ) { refList ( map , a . getAnnotationType ( ) . asElement ( ) ) . add ( holder ) ; } return null ; } @ Override protected Void defaultAction ( Element e , Void p ) { addAnnotations ( e ) ; return null ; } } . visit ( e ) ; }
Map the AnnotationType to the members that use them as type parameters .