Package br.com.seedgrid.privacy.masking
Enum Class MaskingStrategy
- All Implemented Interfaces:
Serializable,Comparable<MaskingStrategy>,Constable
Estratégias de mascaramento de dados pessoais, em nível de valor (string → string).
Antiga AuditRuleTypeEnum do audit — agora agnóstica de JSON/Jackson. A escrita/remoção
no documento é responsabilidade do PersonalDataSanitizer; aqui só transformamos o valor.
REMOVE é estrutural (não transforma valor) — maskValue(String, String)
devolve null e isRemoval() sinaliza ao chamador que o campo deve sair.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionPreserva o formato (CPF, telefone etc) usando o próprioparamcomo máscara pronta.Substitui todo o valor por um fixo (default "***").Hash irreversível (SHA-256 hex) — LGPD safe para lookup sem revelar o valor.Mostra apenas os últimos N caracteres (param= N, default 2).Remove o campo por completo (estrutural).Gabarito posicional:'#'revela o caractere do valor naquela posição,'*'mascara, qualquer outro caractere é literal. -
Method Summary
Modifier and TypeMethodDescriptionprotected static StringapplyTemplate(String value, String template) protected intextractVisible(String param) booleantrueapenas paraREMOVE(operação estrutural, não de valor).abstract StringTransforma o valor conforme a estratégia.protected static booleanstatic MaskingStrategyReturns the enum constant of this class with the specified name.static MaskingStrategy[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
FULL
Substitui todo o valor por um fixo (default "***"). Ex.: "12345678900" → "***" -
FORMAT
Preserva o formato (CPF, telefone etc) usando o próprioparamcomo máscara pronta. Ex.: param "***.***.***-**" → "***.***.***-**" -
PARTIAL
Mostra apenas os últimos N caracteres (param= N, default 2). Ex.: "12345678900" (N=3) → "********900" -
HASH
Hash irreversível (SHA-256 hex) — LGPD safe para lookup sem revelar o valor. -
TEMPLATE
Gabarito posicional:'#'revela o caractere do valor naquela posição,'*'mascara, qualquer outro caractere é literal. Ex.: valor "LUCIANO", param "##*****" → "LU*****" -
REMOVE
Remove o campo por completo (estrutural).maskValue(java.lang.String, java.lang.String)devolvenull.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
maskValue
Transforma o valor conforme a estratégia. ParaREMOVEdevolvenull(o chamador deve remover o campo — verisRemoval()). -
isRemoval
public boolean isRemoval()trueapenas paraREMOVE(operação estrutural, não de valor). -
notBlank
-
extractVisible
-
applyTemplate
-