@Test public void testMapping() { TestUserMapingData data = new TestUserMapingData(); data.setNickName("nick"); data.setTel("13590909090"); String mask = DataMask.toString(data); System.out.println(mask); data.setNickName("**ck"); data.setTel("135*****090"); assertThat(mask).isEqualTo(data.toString()); }
public static String toString(Object object) { if (object == null) { return null; } try { String json = toJSONString(object); Object cloneObj = JSON.parseObject(json, object.getClass()); return cloneObj.toString(); } catch (Exception e) { return object.toString(); } }
DataMask { public static String toString(Object object) { if (object == null) { return null; } try { String json = toJSONString(object); Object cloneObj = JSON.parseObject(json, object.getClass()); return cloneObj.toString(); } catch (Exception e) { return object.toString(); } } }
DataMask { public static String toString(Object object) { if (object == null) { return null; } try { String json = toJSONString(object); Object cloneObj = JSON.parseObject(json, object.getClass()); return cloneObj.toString(); } catch (Exception e) { return object.toString(); } }  }
DataMask { public static String toString(Object object) { if (object == null) { return null; } try { String json = toJSONString(object); Object cloneObj = JSON.parseObject(json, object.getClass()); return cloneObj.toString(); } catch (Exception e) { return object.toString(); } }  static void setHashSalt(String salt); static String mask(String source); static String mask(String source, SensitiveType type); static String mask(String source,MaskStrategy strategy,int...param); static String toJSONString(Object object); static String toString(Object object); }
DataMask { public static String toString(Object object) { if (object == null) { return null; } try { String json = toJSONString(object); Object cloneObj = JSON.parseObject(json, object.getClass()); return cloneObj.toString(); } catch (Exception e) { return object.toString(); } }  static void setHashSalt(String salt); static String mask(String source); static String mask(String source, SensitiveType type); static String mask(String source,MaskStrategy strategy,int...param); static String toJSONString(Object object); static String toString(Object object);  }