ElementPattern<DomTarget> (ElementPattern<? extends DomElement> pattern) { return new ObjectPattern.Capture<>(DomTarget.class).with(new PatternCondition<>("withDomTarget") { @Override public boolean accepts(@NotNull DomTarget target, ProcessingContext context) { return pattern.accepts(target.getDomElement(), context); } }); }