code: public static <T> String requiredStringEnum(Map<String, T> map, String key, List<String> options) {
          String value = requiredString(map, key);
          List<String> uppercaseOptions = options.stream().map(String::toUpperCase).collect(Collectors.toList());
          if (!uppercaseOptions.contains(value.toUpperCase())) {
              String optionsStr = options.stream()
                      .map(option -> String.format("\"%s\"", option))
                      .collect(Collectors.joining(", "));
              String message = String.format("Unsupported value \"%s\" for enumerated string property \"%s\". Valid options: %s",
                                             value,
                                             key,
                                             optionsStr);
              throw new IllegalArgumentException(message);
          }
          return value;
      }
docs: Validates that the value from {@code map} for the given {@code key} is a
  string and is present in {@code options}. Returns the value when valid;
  otherwise, throws an {@code IllegalArgumentException}.
  @param map a map
  @param key a key
  @param options acceptable values
  @param <T> the type of value
  @return The string value
  @throws java.util.NoSuchElementException if the required value is not
  present
  @throws java.lang.IllegalArgumentException if the value is in valid