public static Predicate < Class < ? > > classOrAncestorAnnotatedWith ( final Class < ? extends Annotation > annotationClass , boolean includeMetaAnnotations ) { return candidate -> candidate != null && Classes . from ( candidate ) . traversingSuperclasses ( ) . traversingInterfaces ( ) . classes ( ) . anyMatch ( elementAnnotatedWith ( annotationClass , includeMetaAnnotations ) ) ; }
Checks if the candidate or one of its superclasses or interfaces is annotated with the specified annotation .