Constructor and Description |
---|
FileConverter() |
Modifier and Type | Method and Description |
---|---|
File |
convertFromText(String value,
Class<?> requiredType,
String optionContext)
Converts from the given String value to type T
|
boolean |
getAllPossibleValues(List<Completion> completions,
Class<?> requiredType,
String originalUserInput,
String optionContext,
MethodTarget target)
Populates the given list with the possible completions
|
protected abstract File |
getWorkingDirectory() |
protected void |
populate(List<Completion> completions,
String adjustedUserInput,
String originalUserInput,
String directoryData) |
boolean |
supports(Class<?> requiredType,
String optionContext)
Indicates whether this converter supports the given type in the given option context
|
protected abstract File getWorkingDirectory()
FileConverter
should use if the user fails to provide
an explicit directory in their input (required)public File convertFromText(String value, Class<?> requiredType, String optionContext)
Converter
convertFromText
in interface Converter<File>
value
- the value to convertrequiredType
- the type being converted to; can't be null
optionContext
- a non-null
string that customises the
behaviour of this converter for a given CliOption
of a given
CliCommand
; the contents will have special meaning to this
converter (e.g. be a comma-separated list of keywords known to this
converter)public boolean getAllPossibleValues(List<Completion> completions, Class<?> requiredType, String originalUserInput, String optionContext, MethodTarget target)
Converter
getAllPossibleValues
in interface Converter<File>
completions
- the list to populate; can't be null
requiredType
- the type of parameter for which a string is being enteredoriginalUserInput
- what the user has typed so faroptionContext
- a non-null
string that customises the
behaviour of this converter for a given CliOption
of a given
CliCommand
; the contents will have special meaning to this
converter (e.g. be a comma-separated list of keywords known to this
converter)true
if all the added completions are complete
values, or false
if the user can press TAB to add further
information to some or all of themprotected void populate(List<Completion> completions, String adjustedUserInput, String originalUserInput, String directoryData)
public boolean supports(Class<?> requiredType, String optionContext)
Converter
supports
in interface Converter<File>
requiredType
- the type being checkedoptionContext
- a non-null
string that customises the
behaviour of this converter for a given CliOption
of a given
CliCommand
; the contents will have special meaning to this
converter (e.g. be a comma-separated list of keywords known to this
converter)