Skip to content

Commit

Permalink
feat-IDesensitizationAbility-脱敏算法中支持单例模式
Browse files Browse the repository at this point in the history
  • Loading branch information
aruis committed Dec 13, 2024
1 parent cd3f0bb commit 4b0c02d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
testcontainers = "1.20.3"
quarkus = "3.17.2"
quarkus = "3.17.4"
jdbi = "3.47.0"
yasson = "3.0.4"
bcprov = "1.79"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public void fitOut(TableWrapper wrapper) {

@Override
public Desensitizer getDesensitizer() {
return new Desensitizer().registerAlgorithm("v_name", new MaskMiddleAlgorithm());
return new Desensitizer()
.registerAlgorithm("v_name", MaskMiddleAlgorithm.INSTANCE);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package net.ximatai.muyun.core.desensitization;

public class MaskEmailAlgorithm implements IDesensitizationAlgorithm {
public enum MaskEmailAlgorithm implements IDesensitizationAlgorithm {
INSTANCE;

@Override
public String desensitize(String source) {
if (source == null || !source.contains("@")) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package net.ximatai.muyun.core.desensitization;

public class MaskMiddleAlgorithm implements IDesensitizationAlgorithm {
public enum MaskMiddleAlgorithm implements IDesensitizationAlgorithm {
INSTANCE;

@Override
public String desensitize(String source) {
if (source == null || source.length() <= 2) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package net.ximatai.muyun.core.desensitization;

public class MaskPhoneNumberAlgorithm implements IDesensitizationAlgorithm {
public enum MaskPhoneNumberAlgorithm implements IDesensitizationAlgorithm {
INSTANCE;

@Override
public String desensitize(String source) {
if (source == null || source.length() != 11) {
Expand Down

0 comments on commit 4b0c02d

Please sign in to comment.