code: public void validate(String path, String exceptionMessagePrefix) {
      if (!matches(path)) {
        throw new ValidationException(
            String.format(
                "%s: Parameter \"%s\" must be in the form \"%s\"",
                exceptionMessagePrefix, path, this.toString()));
      }
    }
docs: Throws a ValidationException if the template doesn't match the path. The exceptionMessagePrefix
  parameter will be prepended to the ValidationException message.