FileContentPattern (final StringPattern namePattern) { return with(new PatternCondition<>("withName") { @Override public boolean accepts(@NotNull FileContent fileContent, ProcessingContext context) { return namePattern.accepts(fileContent.getFileName()); } }); }