1 Star 0 Fork 156

whl595145999 / Spring-Analysis

forked from huifer / Code-Analysis 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Spring-TypeConverter.md 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
huifer 提交于 2020-11-16 11:26 . fix: convert 文档修正

Spring TypeConverter

  • 类全路径: org.springframework.beans.TypeConverter
  • 类图 TypeConverter
  • TypeConverter 主要用来做对象转换, TypeConverter 接口具备如下几个方法

方法列表

public interface TypeConverter {

	/**
	 * 将 value 转换成 requiredType 类型
	 */
	@Nullable
	<T> T convertIfNecessary(@Nullable Object value, @Nullable Class<T> requiredType) throws TypeMismatchException;

	/**
     * 将 value 转换成 requiredType 类型, 并且传递 转换方法和转换参数
	 */
	@Nullable
	<T> T convertIfNecessary(@Nullable Object value, @Nullable Class<T> requiredType,
			@Nullable MethodParameter methodParam) throws TypeMismatchException;

	/**
	 */
	@Nullable
	<T> T convertIfNecessary(@Nullable Object value, @Nullable Class<T> requiredType, @Nullable Field field)
			throws TypeMismatchException;

	/**
	 */
	@Nullable
	default <T> T convertIfNecessary(@Nullable Object value, @Nullable Class<T> requiredType,
			@Nullable TypeDescriptor typeDescriptor) throws TypeMismatchException {

		throw new UnsupportedOperationException("TypeDescriptor resolution not supported");
	}

}

实现类分析

Java
1
https://gitee.com/595145999/spring-analysis.git
git@gitee.com:595145999/spring-analysis.git
595145999
spring-analysis
Spring-Analysis
master

搜索帮助