Class EnumConverter

java.lang.Object
com.github.hypfvieh.cli.parser.converter.EnumConverter
All Implemented Interfaces:
IValueConverter<Enum<?>>

public final class EnumConverter extends Object implements IValueConverter<Enum<?>>
Converts a string to an Enum constant of the type specified in the constructor and the same case-insensitive name.
Since:
1.0.4 - 2023-05-11
  • Constructor Details

    • EnumConverter

      public EnumConverter(Class<Enum<?>> _enumType)
  • Method Details

    • convert

      public Enum<?> convert(String _str)
      Description copied from interface: IValueConverter
      Called to convert command line argument String to specified type.
      Specified by:
      convert in interface IValueConverter<Enum<?>>
      Parameters:
      _str - input string, maybe empty/blank, never null
      Returns:
      converted value, never null