-
- Type Parameters:
T
- Type this object convert to.
- All Known Implementing Classes:
BooleanArgumentType
,CaseInsensitiveEnumArgumentType
,CaseInsensitiveEnumNameArgumentType
,CaseInsensitiveEnumStringArgumentType
,ConstructorArgumentType
,EnumArgumentType
,EnumStringArgumentType
,FileArgumentType
,PathArgumentType
,ReflectArgumentType
,StringArgumentType
public interface ArgumentType<T>
This interface defines type conversion method.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
convert(ArgumentParser parser, Argument arg, java.lang.String value)
Convertsvalue
to appropriate type.
-
-
-
Method Detail
-
convert
T convert(ArgumentParser parser, Argument arg, java.lang.String value) throws ArgumentParserException
Converts
value
to appropriate type.If the objects derived from
RuntimeException
are thrown in conversion because of invalid input from command line, subclass must catch these exceptions and wrap them inArgumentParserException
and give simple error message to explain what happened briefly.- Parameters:
parser
- The parser.arg
- The argument this type attached to.value
- The attribute value.- Returns:
- Converted object.
- Throws:
ArgumentParserException
- If conversion fails.
-
-