class CommandLineUtil {

    public static <T extends Enum<T>> T getOptionValue(CommandLine line, String option, Class<T> clazz, T defaultValue) {
        Objects.requireNonNull(line);
        Objects.requireNonNull(option);
        Objects.requireNonNull(clazz);

        if (line.hasOption(option)) {
            return Enum.valueOf(clazz, line.getOptionValue(option));
        } else {
            return defaultValue;
        }
    }

    private  CommandLineUtil();

}