Package picocli
Class CommandLine.BuiltIn.ClassConverter
- java.lang.Object
-
- picocli.CommandLine.BuiltIn.ClassConverter
-
- All Implemented Interfaces:
CommandLine.ITypeConverter<java.lang.Class<?>>
- Enclosing class:
- CommandLine.BuiltIn
static class CommandLine.BuiltIn.ClassConverter extends java.lang.Object implements CommandLine.ITypeConverter<java.lang.Class<?>>
-
-
Constructor Summary
Constructors Constructor Description ClassConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class<?>
convert(java.lang.String s)
Converts the specified command line argument value to some domain object.
-
-
-
Method Detail
-
convert
public java.lang.Class<?> convert(java.lang.String s) throws java.lang.Exception
Description copied from interface:CommandLine.ITypeConverter
Converts the specified command line argument value to some domain object.- Specified by:
convert
in interfaceCommandLine.ITypeConverter<java.lang.Class<?>>
- Parameters:
s
- the command line argument String value- Returns:
- the resulting domain object
- Throws:
java.lang.Exception
- an exception detailing what went wrong during the conversion. Any exception thrown from this method will be caught and shown to the end user. An example error message shown to the end user could look something like this:Invalid value for option '--some-option': cannot convert 'xxxinvalidinput' to SomeType (java.lang.IllegalArgumentException: Invalid format: must be 'x:y:z' but was 'xxxinvalidinput')
CommandLine.TypeConversionException
- throw this exception to have more control over the error message that is shown to the end user when type conversion fails. An example message shown to the user could look like this:Invalid value for option '--some-option': Invalid format: must be 'x:y:z' but was 'xxxinvalidinput'
-
-