百度首页的ip地址百度seo快速排名
学习目标:
实现简单的数据脱敏功能
例如:
- 学习自定义数据脱敏
学习内容:
使用到:泛型、反射
/*** * @param obj 需要数据脱敏的对象* @param par 那些字段需要脱敏* @param <T>* @return* @throws Exception*/public static <T> T transactionData(T obj,String... par)throws Exception{HashSet<String> msgSet = new HashSet<>();for (String item : par) {msgSet.add(item);}Field[] fields = obj.getClass().getDeclaredFields();for (Field field : fields) {if (msgSet.contains(field.getName())) {field.setAccessible(true);field.set(obj,"******");}}return obj;}
学习产出:
提示:这里统计学习计划的总量
例如:
- 技术笔记 1篇