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