StringValidator (@NotNull String validatorId, @NotNull Function<@NotNull String, @NlsContexts.HintText @Nullable String> fn) { return new StringValidator() { @Override public @NotNull String validatorId() { return validatorId; } @Override public @Nullable String getErrorMessage(@Nullable Project project, @NotNull String string) { return fn.apply(string); } }; }