类 StandardTypeConverter
- java.lang.Object
- org.springframework.expression.spel.support.StandardTypeConverter
- 所有已实现的接口:
TypeConverter
public class StandardTypeConverter extends Object implements TypeConverter
Default implementation of theTypeConverter
interface, delegating to a core SpringConversionService
.- 从以下版本开始:
- 3.0
- 作者:
- Juergen Hoeller, Andy Clement
- 另请参阅:
ConversionService
构造器概要
构造器 构造器 说明 StandardTypeConverter()
Create a StandardTypeConverter for the default ConversionService.StandardTypeConverter(ConversionService conversionService)
Create a StandardTypeConverter for the given ConversionService.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 boolean
canConvert(TypeDescriptor sourceType, TypeDescriptor targetType)
Returntrue
if the type converter can convert the specified type to the desired target type.Object
convertValue(Object value, TypeDescriptor sourceType, TypeDescriptor targetType)
Convert (or coerce) a value from one type to another, for example from aboolean
to aString
.
构造器详细资料
StandardTypeConverter
public StandardTypeConverter()
Create a StandardTypeConverter for the default ConversionService.
StandardTypeConverter
public StandardTypeConverter(ConversionService conversionService)
Create a StandardTypeConverter for the given ConversionService.- 参数:
conversionService
- the ConversionService to delegate to
方法详细资料
canConvert
public boolean canConvert(@Nullable TypeDescriptor sourceType, TypeDescriptor targetType)
从接口复制的说明:TypeConverter
Returntrue
if the type converter can convert the specified type to the desired target type.- 指定者:
canConvert
在接口中TypeConverter
- 参数:
sourceType
- a type descriptor that describes the source typetargetType
- a type descriptor that describes the requested result type- 返回:
true
if that conversion can be performed
convertValue
@Nullable public Object convertValue(@Nullable Object value, @Nullable TypeDescriptor sourceType, TypeDescriptor targetType)
从接口复制的说明:TypeConverter
Convert (or coerce) a value from one type to another, for example from aboolean
to aString
.The
TypeDescriptor
parameters enable support for typed collections: A caller may prefer aList<Integer>
, for example, rather than simply anyList
.- 指定者:
convertValue
在接口中TypeConverter
- 参数:
value
- the value to be convertedsourceType
- a type descriptor that supplies extra information about the source objecttargetType
- a type descriptor that supplies extra information about the requested result type- 返回:
- the converted value