org.springframework.shell.converters
Class FileConverter
java.lang.Object
org.springframework.shell.converters.FileConverter
- All Implemented Interfaces:
- Converter<File>
- Direct Known Subclasses:
- SimpleFileConverter
public abstract class FileConverter
- extends Object
- implements Converter<File>
Converter for File.
- Since:
- 1.0
|
Method Summary |
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 |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileConverter
public FileConverter()
getWorkingDirectory
protected abstract File getWorkingDirectory()
- Returns:
- the "current working directory" this
FileConverter should use if the user fails to provide
an explicit directory in their input (required)
convertFromText
public File convertFromText(String value,
Class<?> requiredType,
String optionContext)
- Description copied from interface:
Converter
- Converts from the given String value to type T
- Specified by:
convertFromText in interface Converter<File>
- Parameters:
value - the value to convertrequiredType - the type being converted to; can't be nulloptionContext - 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)
- Returns:
- see above
getAllPossibleValues
public boolean getAllPossibleValues(List<Completion> completions,
Class<?> requiredType,
String originalUserInput,
String optionContext,
MethodTarget target)
- Description copied from interface:
Converter
- Populates the given list with the possible completions
- Specified by:
getAllPossibleValues in interface Converter<File>
- Parameters:
completions - the list to populate; can't be nullrequiredType - 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)
- Returns:
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 them
populate
protected void populate(List<Completion> completions,
String adjustedUserInput,
String originalUserInput,
String directoryData)
supports
public boolean supports(Class<?> requiredType,
String optionContext)
- Description copied from interface:
Converter
- Indicates whether this converter supports the given type in the given option context
- Specified by:
supports in interface Converter<File>
- Parameters:
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)
- Returns:
- see above