docs: java.util.regex.Pattern getPattern(
              @Nonnull AnnotationValue<?> annotationMetadata,
              boolean isOptional) {
          final Optional<String> regexp = annotationMetadata.get("regexp", String.class);
          final String pattern;
  
          if (isOptional) {
              pattern = regexp.orElse(".*");
          } else {
              pattern = regexp
                      .orElseThrow(() -> new ValidationException("No pattern specified"));
          }
  
          final Pattern.Flag[] flags = annotationMetadata.get("flags", Pattern.Flag[].class).orElse(ZERO_FLAGS);
          if (isOptional && pattern.equals(".*") && flags.length == 0) {
              return null;
          }
  
          int computedFlag = 0;
          for (Pattern.Flag flag : flags) {
              computedFlag = computedFlag | flag.getValue();
          }
  
          final PatternKey key = new PatternKey(pattern, computedFlag);
          java.util.regex.Pattern regex = COMPUTED_PATTERNS.get(key);
          if (regex == null) {
              try {
                  if (computedFlag != 0) {
                      regex = java.util.regex.Pattern.compile(pattern, computedFlag);
                  } else {
                      regex = java.util.regex.Pattern.compile(pattern);
                  }
              } catch (PatternSyntaxException e) {
                  throw new IllegalArgumentException("Invalid regular expression", e);
              }
              COMPUTED_PATTERNS.put(key, regex);
          }
          return regex;
      }