ElementPattern (final @NotNull @NonNls String key) { return new ObjectPattern.Capture(new InitialPatternCondition(Object.class) { @Override public boolean accepts(final @Nullable Object o, final ProcessingContext context) { return Comparing.equal(o, context.get(key)); } @Override public void append(final @NotNull @NonNls StringBuilder builder, final String indent) { builder.append("get(").append(key).append(")"); } }); }