类 StreamConverter
java.lang.Object
cn.taketoday.core.conversion.support.StreamConverter
Converts a
Stream to and from a collection or array, converting the
element type if necessary.- 从以下版本开始:
- 4.0
- 作者:
- Stephane Nicoll
-
嵌套类概要
从接口继承的嵌套类/接口 cn.taketoday.core.conversion.GenericConverter
GenericConverter.ConvertiblePair -
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) Convert the source object to the targetType described by theTypeDescriptor.private ObjectconvertFromStream(Stream<?> source, TypeDescriptor streamType, TypeDescriptor targetType) private ObjectconvertToStream(Object source, TypeDescriptor sourceType, TypeDescriptor streamType) Return the source and target types that this converter can convert between.booleanmatches(TypeDescriptor sourceType, TypeDescriptor targetType) Should the conversion fromsourceTypetotargetTypecurrently under consideration be selected?booleanmatchesFromStream(TypeDescriptor elementType, TypeDescriptor targetType) Validate that aCollectionof the elements held within the stream can be converted to the specifiedtargetType.booleanmatchesToStream(TypeDescriptor elementType, TypeDescriptor sourceType) Validate that the specifiedsourceTypecan be converted to aCollectionof the type of the stream elements.
-
字段详细资料
-
STREAM_TYPE
-
conversionService
-
-
构造器详细资料
-
StreamConverter
StreamConverter(ConversionService conversionService)
-
-
方法详细资料
-
getConvertibleTypes
从接口复制的说明:GenericConverterReturn the source and target types that this converter can convert between.Each entry is a convertible source-to-target type pair.
For
conditional convertersthis method may returnnullto indicate all source-to-target pairs should be considered.- 指定者:
getConvertibleTypes在接口中GenericConverter
-
matches
从接口复制的说明:ConditionalConverterShould the conversion fromsourceTypetotargetTypecurrently under consideration be selected?- 指定者:
matches在接口中ConditionalConverter- 参数:
sourceType- the type descriptor of the field we are converting fromtargetType- the type descriptor of the field we are converting to- 返回:
- true if conversion should be performed, false otherwise
-
matchesFromStream
Validate that aCollectionof the elements held within the stream can be converted to the specifiedtargetType.- 参数:
elementType- the type of the stream elementstargetType- the type to convert to
-
matchesToStream
Validate that the specifiedsourceTypecan be converted to aCollectionof the type of the stream elements.- 参数:
elementType- the type of the stream elementssourceType- the type to convert from
-
convert
@Nullable public Object convert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType) 从接口复制的说明:GenericConverterConvert the source object to the targetType described by theTypeDescriptor.- 指定者:
convert在接口中GenericConverter- 参数:
source- the source object to convert (may benull)sourceType- the type descriptor of the field we are converting fromtargetType- the type descriptor of the field we are converting to- 返回:
- the converted object
-
convertFromStream
@Nullable private Object convertFromStream(@Nullable Stream<?> source, TypeDescriptor streamType, TypeDescriptor targetType) -
convertToStream
private Object convertToStream(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor streamType)
-