Interface TypeConverter

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface TypeConverter
类型转换接口函数,根据给定的值和目标类型,由用户自定义转换规则。
Since:
Java 17+
Author:
Kimi Liu
  • Method Summary

    Modifier and Type
    Method
    Description
    convert(Type targetType, Object value)
    转换为指定类型 如果类型无法确定,将读取默认值的类型做为目标类型
  • Method Details

    • convert

      Object convert(Type targetType, Object value)
      转换为指定类型 如果类型无法确定,将读取默认值的类型做为目标类型
      Parameters:
      targetType - 目标Type,非泛型类使用
      value - 原始值
      Returns:
      转换后的值
      Throws:
      IllegalArgumentException - 无法确定目标类型,且默认值为null,无法确定类型