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