Interface ArgumentType<T>

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

    Modifier and Type
    Method
    Description
    convert(ArgumentParser parser, Argument arg, String value)
    Converts value to appropriate type.
  • Method Details

    • convert

      T convert(ArgumentParser parser, Argument arg, 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 in ArgumentParserException 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.