PsiClassPattern (final boolean checkDeep, final ElementPattern<? extends PsiMethod> memberPattern) { return with(new PatternCondition<PsiClass>("withMethod") { @Override public boolean accepts(@NotNull final PsiClass psiClass, final ProcessingContext context) { for (PsiMethod method : (checkDeep ? psiClass.getAllMethods() : psiClass.getMethods())) { if (memberPattern.accepts(method, context)) { return true; } } return false; } }); }