Class EnumArgumentType<T extends Enum<T>>
- Type Parameters:
T- Type of enum
- All Implemented Interfaces:
ArgumentType<T>
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...).
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvert(ArgumentParser parser, Argument arg, String value) Deprecated.Convertsvalueto appropriate type.
-
Field Details
-
type_
Deprecated.
-
-
Constructor Details
-
EnumArgumentType
Deprecated.
-
-
Method Details
-
convert
Deprecated.Description copied from interface:ArgumentTypeConverts
valueto appropriate type.If the objects derived from
RuntimeExceptionare thrown in conversion because of invalid input from command line, subclass must catch these exceptions and wrap them inArgumentParserExceptionand give simple error message to explain what happened briefly.- Specified by:
convertin interfaceArgumentType<T extends Enum<T>>- Parameters:
parser- The parser.arg- The argument this type attached to.value- The attribute value.- Returns:
- Converted object.
- Throws:
ArgumentParserException- If conversion fails.
-
ReflectArgumentTypeinstead.