@Contract("null,_ -> false") public static boolean checkAnnotatedUsingPatterns(@Nullable PsiModifierListOwner owner,@NotNull Collection<String> annotations){
  final PsiModifierList modList;
  if (owner == null || (modList=owner.getModifierList()) == null)   return false;
  List<String> fqns=null;
  for (  String fqn : annotations) {
    boolean isPattern=fqn.endsWith("*");
    if (!isPattern && isAnnotated(owner,fqn,false)) {
      return true;
    }
 else     if (isPattern) {
      if (fqns == null) {
        fqns=new ArrayList<String>();
        final PsiAnnotation[] annos=modList.getAnnotations();
        for (        PsiAnnotation anno : annos) {
          final String qName=anno.getQualifiedName();
          if (qName != null) {
            fqns.add(qName);
          }
        }
        if (fqns.isEmpty())         return false;
      }
      fqn=fqn.substring(0,fqn.length() - 2);
      for (      String annoFQN : fqns) {
        if (annoFQN.startsWith(fqn)) {
          return true;
        }
      }
    }
  }
  return false;
}

@ Contract ( "null,_ -> false" ) public static boolean checkAnnotatedUsingPatterns ( @ Nullable PsiModifierListOwner owner , @ NotNull Collection < String > annotations ) { final PsiModifierList modList ; if ( owner == null || ( modList = owner . getModifierList ( ) ) == null ) return false ; List < String > fqns = null ; for ( String fqn : annotations ) { boolean isPattern = fqn . endsWith ( "*" ) ; if ( ! isPattern && isAnnotated ( owner , fqn , false ) ) { return true ; } else if ( isPattern ) { if ( fqns == null ) { fqns = new ArrayList < String > ( ) ; final PsiAnnotation [ ] annos = modList . getAnnotations ( ) ; for ( PsiAnnotation anno : annos ) { final String qName = anno . getQualifiedName ( ) ; if ( qName != null ) { fqns . add ( qName ) ; } } if ( fqns . isEmpty ( ) ) return false ; } fqn = fqn . substring ( 0 , fqn . length ( ) - 2 ) ; for ( String annoFQN : fqns ) { if ( annoFQN . startsWith ( fqn ) ) { return true ; } } } } return false ; }
works similar to # isannotated ( psimodifierlistowner , collection < string > ) but supports fqn patters like " javax . ws . rs . * " . supports ending " * " only .
