Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f5a653ca6a |
@@ -437,4 +437,102 @@ public final class MaskingUtils {
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
public static final int ResidentNumber = 11;
|
||||
public static final int DriverLicense = 12;
|
||||
public static final int Passport = 13;
|
||||
public static final int ForeignerNumber = 14;
|
||||
|
||||
public static final int AccountNumber = 21;
|
||||
public static final int CardNumber = 22;
|
||||
public static final int CardExpiry = 23;
|
||||
public static final int Cvv = 24;
|
||||
|
||||
public static final int Password = 31;
|
||||
|
||||
public static final int PhoneNumber = 41;
|
||||
public static final int MobileNumber = 41;
|
||||
public static final int FaxNumber = 41;
|
||||
public static final int Email = 42;
|
||||
public static final int KoreanName = 43;
|
||||
public static final int EnglishName = 44;
|
||||
public static final int JibunAddress = 45;
|
||||
public static final int RoadAddress = 46;
|
||||
|
||||
public static final int Ip = 51;
|
||||
|
||||
public static final int All = 99;
|
||||
|
||||
/**
|
||||
* 마스킹 타입코드에 맞추어 마스킹 처리
|
||||
*
|
||||
* @param str
|
||||
* @param maskOffset
|
||||
* @return
|
||||
*/
|
||||
public static String mask(String str, int maskOffset) {
|
||||
switch (maskOffset) {
|
||||
case ResidentNumber:
|
||||
return maskResidentNumber(str);
|
||||
|
||||
case DriverLicense:
|
||||
return maskDriverLicense(str);
|
||||
|
||||
case Passport:
|
||||
return maskPassport(str);
|
||||
|
||||
case ForeignerNumber:
|
||||
return maskForeignerNumber(str);
|
||||
|
||||
case AccountNumber:
|
||||
return maskAccountNumber(str);
|
||||
|
||||
case CardNumber:
|
||||
return maskCardNumber(str);
|
||||
|
||||
case CardExpiry:
|
||||
return maskCardExpiry(str);
|
||||
|
||||
case Cvv:
|
||||
return maskCvv(str);
|
||||
|
||||
case Password:
|
||||
return maskPassword(str);
|
||||
|
||||
// PhoneNumber(41) = MobileNumber(41) = FaxNumber(41): 값이 같아
|
||||
// case 레이블을 각각 선언하면 컴파일 에러(중복 case)이므로 하나로 통합.
|
||||
// maskPhoneNumber가 전화/휴대폰/팩스 형식을 모두 처리함.
|
||||
case PhoneNumber:
|
||||
return maskPhoneNumber(str);
|
||||
|
||||
case Email:
|
||||
return maskEmail(str);
|
||||
|
||||
case KoreanName:
|
||||
return maskKoreanName(str);
|
||||
|
||||
case EnglishName:
|
||||
return maskEnglishName(str);
|
||||
|
||||
case JibunAddress:
|
||||
return maskJibunAddress(str);
|
||||
|
||||
case RoadAddress:
|
||||
return maskRoadAddress(str);
|
||||
|
||||
case Ip:
|
||||
return maskIpAddress(str);
|
||||
|
||||
case All:
|
||||
return stars(str.length());
|
||||
|
||||
default:
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user