code: public static <T> Constraint
              checking(Function<String, T> check, String messageOrKey, boolean isKey, String... extraMessageArgs) {
          return mkSimpleConstraint(((label, vString, messages) -> {
              logger.debug("checking for {}", vString);
  
              if (isEmptyStr(vString)) return null;
              else {
                  try {
                      check.apply(vString);
                      return null;
                  } catch (Exception ex) {
                      String msgTemplate = isKey ? messages.get(messageOrKey) : messageOrKey;
                      List<String> messageArgs = appendList(Arrays.asList(vString), extraMessageArgs);
                      return String.format(msgTemplate, messageArgs.toArray());
                  }
              }
          }), null);
      }
docs: make a Constraint which will try to check and collect errors