code: @SuppressWarnings("unchecked")
    public static <T extends Enum> @Nullable T getEnum(@NotNull ServletRequest request, @NotNull String param, @NotNull Class<T> enumClass,
        @Nullable T defaultValue) {
      String value = RequestParam.get(request, param);
      if (StringUtils.isNotEmpty(value)) {
        try {
          return (T)Enum.valueOf(enumClass, value);
        }
        catch (IllegalArgumentException ex) {
          // ignore, return default
        }
      }
      return defaultValue;
    }
docs: Returns a request parameter as enum value.
  @param <T> Enum type
  @param request Request.
  @param param Parameter name.
  @param enumClass Enum class
  @param defaultValue Default value.
  @return Parameter value or the default value if it is not set or an invalid enum value.