Class DefaultConverter

java.lang.Object
com.alipay.sofa.common.config.converter.DefaultConverter
All Implemented Interfaces:
Converter

public class DefaultConverter extends Object implements Converter
Version:
: DefaultConverter.java, v 0.1 2020年12月09日 11:51 上午 zhaowang Exp $
Author:
zhaowang
  • Constructor Details

    • DefaultConverter

      public DefaultConverter()
  • Method Details

    • convert

      public <T> T convert(String value, Class<T> targetType)
      Description copied from interface: Converter
      Convert value to target type object.
      Specified by:
      convert in interface Converter
      Parameters:
      value - source value
      targetType - target type
      Returns:
      object of target type
    • convertObjectFromString

      public static Object convertObjectFromString(Class<?> type, String value)
      TODO 需要考虑java的类型转换。 float 4 字节 32位IEEE 754单精度 double 8 字节 64位IEEE 754双精度 byte 1字节 -128到127 short 2 字节 -32,768到32,767 int 4 字节 -2,147,483,648到2,147,483,647 long 8 字节 -9,223,372,036,854,775,808到9,223,372,036, 854,775,807 char 2 字节 整个Unicode字符集 boolean 1 位 True或者false
      Parameters:
      type - the type must not be null
      value - the value
      Returns:
      object
    • paresJson2ListMap

      public static List<HashMap<Object,Object>> paresJson2ListMap(String s)
      Pares json to list map list.
      Parameters:
      s - the s
      Returns:
      the list