mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 12:18:42 +08:00 
			
		
		
		
	✨ 全局:简化 file 组件,融合到 infra 模块
This commit is contained in:
		@@ -136,6 +136,21 @@ public class JsonUtils {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 解析 JSON 字符串成指定类型的对象,如果解析失败,则返回 null
 | 
			
		||||
     *
 | 
			
		||||
     * @param text 字符串
 | 
			
		||||
     * @param typeReference 类型引用
 | 
			
		||||
     * @return 指定类型的对象
 | 
			
		||||
     */
 | 
			
		||||
    public static <T> T parseObjectQuietly(String text, TypeReference<T> typeReference) {
 | 
			
		||||
        try {
 | 
			
		||||
            return objectMapper.readValue(text, typeReference);
 | 
			
		||||
        } catch (IOException e) {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static <T> List<T> parseArray(String text, Class<T> clazz) {
 | 
			
		||||
        if (StrUtil.isEmpty(text)) {
 | 
			
		||||
            return new ArrayList<>();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user