public <T extends Enum<T>> T getEnum(
      final Class<T> enumClass, final ConfigOption<String> configOption) {
    checkNotNull(enumClass, "enumClass must not be null");
    checkNotNull(configOption, "configOption must not be null");

    Object rawValue = getRawValueFromOption(configOption).orElseGet(configOption::defaultValue);
    try {
      return ConfigHelpers.convertToEnum(rawValue, enumClass);
    } catch (IllegalArgumentException ex) {
      final String errorMessage =
          String.format(
              "Value for config option %s must be one of %s (was %s)",
              configOption.key(), Arrays.toString(enumClass.getEnumConstants()), rawValue);
      throw new IllegalArgumentException(errorMessage);
    }
  }
Returns the value associated with the given config option as an enum.

@param enumClass The return enum class
@param configOption The configuration option
@throws IllegalArgumentException If the string associated with the given config option cannot
    be parsed as a value of the provided enum class.
amoro-common/src/main/java/org/apache/amoro/config/Configurations.java