类 CollectionToArrayConverter

java.lang.Object
cn.taketoday.core.conversion.support.CollectionToArrayConverter
所有已实现的接口:
ConditionalConverter, ConditionalGenericConverter, GenericConverter

final class CollectionToArrayConverter extends Object implements ConditionalGenericConverter
Converts a Collection to an array.

First, creates a new array of the requested targetType with a length equal to the size of the source Collection. Then sets each collection element into the array. Will perform an element conversion from the collection's parameterized type to the array's component type if necessary.

从以下版本开始:
3.0
作者:
Keith Donald, Juergen Hoeller, TODAY
  • 字段详细资料

  • 构造器详细资料

    • CollectionToArrayConverter

      public CollectionToArrayConverter(ConversionService conversionService)
  • 方法详细资料

    • getConvertibleTypes

      public Set<GenericConverter.ConvertiblePair> getConvertibleTypes()
      从接口复制的说明: GenericConverter
      Return the source and target types that this converter can convert between.

      Each entry is a convertible source-to-target type pair.

      For conditional converters this method may return null to indicate all source-to-target pairs should be considered.

      指定者:
      getConvertibleTypes 在接口中 GenericConverter
    • matches

      public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType)
      从接口复制的说明: ConditionalConverter
      Should the conversion from sourceType to targetType currently under consideration be selected?
      指定者:
      matches 在接口中 ConditionalConverter
      参数:
      sourceType - the type descriptor of the field we are converting from
      targetType - the type descriptor of the field we are converting to
      返回:
      true if conversion should be performed, false otherwise
    • convert

      @Nullable public Object convert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType)
      从接口复制的说明: GenericConverter
      Convert the source object to the targetType described by the TypeDescriptor.
      指定者:
      convert 在接口中 GenericConverter
      参数:
      source - the source object to convert (may be null)
      sourceType - the type descriptor of the field we are converting from
      targetType - the type descriptor of the field we are converting to
      返回:
      the converted object