PsiNameValuePairPattern (@NotNull @NonNls final String requiredName) { return with(new PatternCondition<PsiNameValuePair>("withName") { @Override public boolean accepts(@NotNull final PsiNameValuePair psiNameValuePair, final ProcessingContext context) { String actualName = psiNameValuePair.getName(); return requiredName.equals(actualName) || actualName == null && "value".equals(requiredName); } }); }