- java.lang.Object
-
- picocli.CommandLine.UseDefaultConverter
-
- All Implemented Interfaces:
CommandLine.ITypeConverter<Object>
- Enclosing class:
- CommandLine
public static final class CommandLine.UseDefaultConverter extends Object implements CommandLine.ITypeConverter<Object>
Converter that can be used to signal to picocli that it should use the default converter. This can be useful with maps:class App { @Option(names = "-D", converter = {UseDefaultConverter.class, GenericValueConverter.class}) Map<String, GenericValue<?>> values; }
Theconvert(String)
method of this class always throws an UnsupportedOperationException.- Since:
- 4.7.6
-
-
Constructor Summary
Constructors Constructor Description UseDefaultConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
convert(String value)
Always throws UnsupportedOperationException.
-
-
-
Method Detail
-
convert
public Object convert(String value) throws Exception
Always throws UnsupportedOperationException.- Specified by:
convert
in interfaceCommandLine.ITypeConverter<Object>
- Parameters:
value
- the command line argument String value- Returns:
- the resulting domain object
- Throws:
UnsupportedOperationException
- alwaysException
- 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'
-
-