Package cn.toutatis.xvoid.toolkit.data
Class DesensitizationToolkit
-
- All Implemented Interfaces:
public class DesensitizationToolkit信息脱敏工具
对于身份证手机号等敏感信息,默认前端展示时需要隐藏部分内容
支持list,map
例如手机号11位数177****0355隐藏中间四位数
Tutatis_Gc
-
-
Constructor Summary
Constructors Constructor Description DesensitizationToolkit()
-
Method Summary
Modifier and Type Method Description static <P> List<P>hiddenInfo(List<P> list, Array<String> fields)批量脱敏数据 static Map<String, Object>hiddenInfo(Map<String, Object> map, Array<String> fields)map对象字段信息脱敏,脱敏字段需要为基础类型或基础类型的包装类复杂类型对象则不可转换注意:字段会转换成string类型 static StringhiddenInfo(String info)脱敏方法,该方法的根据字符串长度隐藏中间部分敏感信息通用解决方案,将字符串拆分成三部分,隐藏中间部分打*号 static StringhiddenInfo(String info, String customSymbol)脱敏方法,该方法的根据字符串长度隐藏中间部分敏感信息 -
-
Method Detail
-
hiddenInfo
static <P> List<P> hiddenInfo(List<P> list, Array<String> fields)
批量脱敏数据
- Parameters:
list- 需要脱敏的listfields- 脱敏字段- Returns:
脱敏后的数据
-
hiddenInfo
static Map<String, Object> hiddenInfo(Map<String, Object> map, Array<String> fields)
map对象字段信息脱敏,脱敏字段需要为基础类型或基础类型的包装类
复杂类型对象则不可转换
注意:字段会转换成string类型
- Parameters:
map- map对象fields- 需要脱敏字段- Returns:
已脱敏数据
-
hiddenInfo
static String hiddenInfo(String info)
脱敏方法,该方法的根据字符串长度隐藏中间部分敏感信息
通用解决方案,将字符串拆分成三部分,隐藏中间部分打*号
- Parameters:
info- 需要隐藏敏感的字符串- Returns:
脱敏信息
-
hiddenInfo
static String hiddenInfo(String info, String customSymbol)
脱敏方法,该方法的根据字符串长度隐藏中间部分敏感信息
- Parameters:
info- 需要隱藏的信息customSymbol- 自定义脱敏符号(一般推荐使用*)- Returns:
脱敏信息
-
-
-
-