StringPattern (final int length) { return with(new PatternCondition<String>("withLength") { @Override public boolean accepts(final @NotNull String s, final ProcessingContext context) { return s.length() == length; } }); }