All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.amossun.starter.common.util.DesensitizedExecutor Maven / Gradle / Ivy

package cn.amossun.starter.common.util;

import cn.amossun.starter.common.enums.DesensitizedType;

public class DesensitizedExecutor {

    public static String desensitized(DesensitizedType type, String origin){

        String result;

        switch (type) {
            case DEFAULT_SKIP:
                return origin;
            case CHINESE_NAME:
                result = DesensitizedUtils.chineseName(origin);
                break;
            case ID_CARD:
                result = DesensitizedUtils.idCardNum(origin);
                break;
            case PASSPORT:
                result = DesensitizedUtils.idPassport(origin);
                break;
            case FIXED_PHONE:
                result = DesensitizedUtils.fixedPhone(origin);
                break;
            case MOBILE_PHONE:
                result = DesensitizedUtils.mobilePhone(origin);
                break;
            case ADDRESS:
                result = DesensitizedUtils.address(origin);
                break;
            case EMAIL:
                result = DesensitizedUtils.email(origin);
                break;
            case BANK_CARD:
                result = DesensitizedUtils.bankCard(origin);
                break;
            case PASSWORD:
                result = DesensitizedUtils.password(origin);
                break;
            case KEY:
                result = DesensitizedUtils.key(origin);
                break;
            default:
                throw new IllegalArgumentException("Unknown sensitive type enum " + type);
        }

        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy