import com.alibaba.fastjson.JSONObject;import java.util.List;import java.util.stream.Collectors;public class ConverterUtil {public static <T> List<T> convertList(List<?> sourceList, Class<T> clazz) {return sourceList.stream().map(source -> (T) JSONObject.parseObject(JSONObject.toJSONString(source), clazz)).collect(Collectors.toList());}public static <T> T convert(Object source, Class<T> target) {return JSONObject.parseObject(JSONObject.toJSONString(source), target);}}
