public Self withLocalName(final ElementPattern<String> localName) {
    return with(new PsiNamePatternCondition<>("withLocalName", localName) {
      @Override
      public String getPropertyValue(@NotNull final Object o) {
        return o instanceof XmlElement ? getLocalName((T)o) : null;
      }
    });
  }
public Self withLocalName(final ElementPattern<String> localName)