< A extends Annotation > A findAnnotation ( TypeElement element , Class < A > anno ) { final A annotation = element . getAnnotation ( anno ) ; if ( annotation != null ) { return annotation ; } final TypeMirror typeMirror = element . getSuperclass ( ) ; if ( typeMirror . getKind ( ) == TypeKind . NONE ) { return null ; } final TypeElement element1 = ( TypeElement ) typeUtils . asElement ( typeMirror ) ; return findAnnotation ( element1 , anno ) ; }
Find the annotation searching the inheritance hierarchy .