Class EntryConverter

java.lang.Object
org.miaixz.bus.core.convert.EntryConverter
All Implemented Interfaces:
Converter

public class EntryConverter extends Object implements Converter
Map.Entry 转换器,支持以下类型转为Entry
  • Map
  • Map.Entry
  • 带分隔符的字符串,支持分隔符:=,
  • Bean,包含getKeygetValue方法
Since:
Java 17+
Author:
Kimi Liu
  • Field Details

  • Constructor Details

    • EntryConverter

      public EntryConverter()
  • Method Details

    • convert

      public Object convert(Type targetType, Object value) throws ConvertException
      Description copied from interface: Converter
      转换为指定类型 如果类型无法确定,将读取默认值的类型做为目标类型
      Specified by:
      convert in interface Converter
      Parameters:
      targetType - 目标Type,非泛型类使用
      value - 原始值,如果对象实现了此接口,则value为this
      Returns:
      转换后的值
      Throws:
      ConvertException - 转换无法正常完成或转换异常时抛出此异常
    • convert

      public Map.Entry<?,?> convert(Type targetType, Type keyType, Type valueType, Object value) throws ConvertException
      转换对象为指定键值类型的指定类型Map
      Parameters:
      targetType - 目标的Map类型
      keyType - 键类型
      valueType - 值类型
      value - 被转换的值
      Returns:
      转换后的Map
      Throws:
      ConvertException - 转换异常或不支持的类型