T - the type being converted to/frompublic interface Converter<T>
| Modifier and Type | Method and Description |
|---|---|
T |
convertFromText(String value,
Class<?> targetType,
String optionContext)
Converts from the given String value to type T
|
boolean |
getAllPossibleValues(List<Completion> completions,
Class<?> targetType,
String existingData,
String optionContext,
MethodTarget target)
Populates the given list with the possible completions
|
boolean |
supports(Class<?> type,
String optionContext)
Indicates whether this converter supports the given type in the given
option context
|
T convertFromText(String value, Class<?> targetType, String optionContext)
value - the value to converttargetType - 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)RuntimeException - if the given value could not be convertedboolean getAllPossibleValues(List<Completion> completions, Class<?> targetType, String existingData, String optionContext, MethodTarget target)
completions - the list to populate; can't be nulltargetType - the type of parameter for which a string is being
enteredexistingData - 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)target - 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 themboolean supports(Class<?> type, String optionContext)
type - 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)Copyright © 2009–2017 Pivotal Software, Inc.. All rights reserved.