Interface MultiValueConverter<S>

Type Parameters:
S - The source type
All Superinterfaces:
Comparable<Prioritized>, Prioritized
All Known Subinterfaces:
StringToMultiValueConverter
All Known Implementing Classes:
StringToArrayConverter, StringToBlockingDequeConverter, StringToBlockingQueueConverter, StringToCollectionConverter, StringToDequeConverter, StringToIterableConverter, StringToListConverter, StringToNavigableSetConverter, StringToQueueConverter, StringToSetConverter, StringToSortedSetConverter, StringToTransferQueueConverter

@SPI(scope=FRAMEWORK) public interface MultiValueConverter<S> extends Prioritized
An interface to convert the source-typed value to multiple value, e.g , Java array, Collection or sub-interfaces
Since:
2.7.6
  • Method Details

    • accept

      boolean accept(Class<S> sourceType, Class<?> multiValueType)
      Accept the source type and target type or not
      Parameters:
      sourceType - the source type
      multiValueType - the multi-value type
      Returns:
      if accepted, return true, or false
    • convert

      Object convert(S source, Class<?> multiValueType, Class<?> elementType)
      Convert the source to be the multiple value
      Parameters:
      source - the source-typed value
      multiValueType - the multi-value type
      elementType - the element type
      Returns:
    • getSourceType

      default Class<S> getSourceType()
      Get the source type
      Returns:
      non-null
    • find

      @Deprecated static MultiValueConverter<?> find(Class<?> sourceType, Class<?> targetType)
      Deprecated.
      will be removed in 3.3.0
      Find the MultiValueConverter instance from ExtensionLoader with the specified source and target type
      Parameters:
      sourceType - the source type
      targetType - the target type
      Returns:
      null if not found
      Since:
      2.7.8
      See Also:
    • convertIfPossible

      @Deprecated static <T> T convertIfPossible(Object source, Class<?> multiValueType, Class<?> elementType)
      Deprecated.
      will be removed in 3.3.0