Package br.com.seedgrid.privacy
Enum Class SearchNormalization
- All Implemented Interfaces:
Serializable,Comparable<SearchNormalization>,Constable
Como normalizar um valor antes de gerar o hash de busca de um
EncryptedField.
A busca por igualdade só encontra o registro se o mesmo modo for aplicado na gravação
(pelo EncryptedFieldListener) e na consulta (pelo EncryptedFieldSearch). Escolha o
modo pela natureza do dado.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionapply(String value, ValueNormalizer canonicalNormalizer) Aplica a normalização.static SearchNormalizationReturns the enum constant of this class with the specified name.static SearchNormalization[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
Sem normalização: hash do valor exato, byte a byte (case-sensitive). -
CANONICAL
Canônica:trim, remove acentos (NFD),lowercasee mantém só[a-z0-9]. Ideal para documentos e telefones (CPF, CNPJ, telefone, CEP) — tolera pontuação/formatação sem risco de colisão, porque são sequências de dígitos. -
EMAIL
E-mail: apenastrim+lowercase, preservando@ . - _etc. É a única normalização segura para e-mail: aplicar aCANONICAL(que remove pontuação) fariajoao@x.comejoa@ox.comcolidirem no mesmo hash.
-
-
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
-
apply
Aplica a normalização.canonicalNormalizeré usado apenas porCANONICAL(permite injetar um normalizador customizado); os demais modos o ignoram.
-