PsiClassPattern (final boolean checkDeep, final ElementPattern<? extends PsiField> memberPattern) { return with(new PatternCondition<PsiClass>("withField") { @Override public boolean accepts(@NotNull final PsiClass psiClass, final ProcessingContext context) { for (PsiField field : (checkDeep ? psiClass.getAllFields() : psiClass.getFields())) { if (memberPattern.accepts(field, context)) { return true; } } return false; } }); }