PsiNameValuePairPattern (@NotNull final ElementPattern<String> name) { return with(new PsiNamePatternCondition<PsiNameValuePair>("withName", name) { @Override public String getPropertyValue(@NotNull Object o) { if (o instanceof PsiNameValuePair) { final String nameValue = ((PsiNameValuePair)o).getName(); return StringUtil.notNullize(nameValue, "value"); } return null; } }); }