Class EnumArgumentType<T extends Enum<T>>

java.lang.Object
net.sourceforge.argparse4j.impl.type.EnumArgumentType<T>
Type Parameters:
T - Type of enum
All Implemented Interfaces:
ArgumentType<T>

public class EnumArgumentType<T extends Enum<T>> extends Object implements ArgumentType<T>
Deprecated.
Use ReflectArgumentType instead.

ArgumentType subclass for enum type.

Since enum does not have a constructor with string argument, it cannot be used with Argument.type(Class). Instead use this class to specify enum type. The enums in its nature have limited number of members. In convert(ArgumentParser, Argument, String), String value will be converted to one of them. If it cannot be converted, convert(ArgumentParser, Argument, String) will throw ArgumentParserException. This means it already act like a Argument.choices(Object...).

  • Constructor Details

    • EnumArgumentType

      public EnumArgumentType(Class<T> type)
      Deprecated.
  • Method Details