org.springframework.shell.core

## Interface Converter<T>

- Type Parameters:
    `T` - the type being converted to/from
  All Known Subinterfaces:
    StaticFieldConverter
  All Known Implementing Classes:
    ArrayConverter, AvailableCommandsConverter, BigDecimalConverter, BigIntegerConverter, BooleanConverter, CharacterConverter, DateConverter, DoubleConverter, EnumConverter, FileConverter, FloatConverter, IntegerConverter, LocaleConverter, LongConverter, ShortConverter, SimpleFileConverter, StaticFieldConverterImpl, StringConverter

      public interface Converter<T>

  Converts between Strings (as displayed by and entered via the shell) and Java objects

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `TAB_COMPLETION_COUNT_PREFIX` The prefix for the option context property that indicates how many successive tab completion requests have occurred.

  - ### Method Summary

    Methods
    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

- - ### Field Detail

    - #### TAB_COMPLETION_COUNT_PREFIX

          static final String TAB_COMPLETION_COUNT_PREFIX

      The prefix for the option context property that indicates how many successive tab completion requests have occurred.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### supports

          boolean supports(Class<?> type,
                         String optionContext)

      Indicates whether this converter supports the given type in the given option context
      Parameters:
        `type` - the type being checked
        `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)
      Returns:
        see above

    - #### convertFromText

          T convertFromText(String value,
                          Class<?> targetType,
                          String optionContext)

      Converts from the given String value to type T
      Parameters:
        `value` - the value to convert
        `targetType` - 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)
      Returns:
        see above
      Throws:
        `RuntimeException` - if the given value could not be converted

    - #### getAllPossibleValues

          boolean getAllPossibleValues(List<Completion> completions,
                                     Class<?> targetType,
                                     String existingData,
                                     String optionContext,
                                     MethodTarget target)

      Populates the given list with the possible completions
      Parameters:
        `completions` - the list to populate; can't be `null`
        `targetType` - the type of parameter for which a string is being entered
        `existingData` - what the user has typed so far
        `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)
        `target` -
      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