Package overit.geocall.basic.anonymizer
Class Anonymizer.TextAnonymizer
java.lang.Object
overit.geocall.basic.anonymizer.Anonymizer.AbstractAnonymizer<String,Anonymizer.TextAnonymizer>
overit.geocall.basic.anonymizer.Anonymizer.TextAnonymizer
- Enclosing class:
Anonymizer
public class Anonymizer.TextAnonymizer
extends Anonymizer.AbstractAnonymizer<String,Anonymizer.TextAnonymizer>
Anonymizer used to obfuscate a fields containg string values. If the context doesn't contains the field assigned to this instance,
all'the method of this class will not change the context.
-
Field Summary
Fields inherited from class overit.geocall.basic.anonymizer.Anonymizer.AbstractAnonymizer
_field -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd a prefix to the current field's value.Set a random string as value of the field assigned to this instance.Set a random string as value of the field assigned to this instance.protected Anonymizer.TextAnonymizerMethods inherited from class overit.geocall.basic.anonymizer.Anonymizer.AbstractAnonymizer
setValue, validate
-
Constructor Details
-
TextAnonymizer
-
-
Method Details
-
addPrefix
Add a prefix to the current field's value. Pay attention to call this method after the anonymize, otherwise the prefixed value will be overwritten. For example, we assume thatanonymize(RandomToken.LOWERCASE)set the value "abcdefg". If we call this method after the anonymize
into the context we will find the valueanonymize(RandomToken.LOWERCASE).addPrefix("UNKNOWN_")"UNKNOWN_abcdefg". If we call the same methods but in the reverse order
the context will be update with the valueaddPrefix("UNKNOWN_").anonymize(RandomToken.LOWERCASE)"abcdefg"; that's why the second method has overwritten the changes made by the first one.- Parameters:
prefix- string that will be appended before the current value- Returns:
- a reference of this object.
-
anonymize
Set a random string as value of the field assigned to this instance. The length of the generated string will be the same as the original one.- Parameters:
alphabet- String containing the characters that will be used to generate the random string. Typically you can use these predefined set of alphabet:RandomToken.ALPHA_DIGIT: uppercase/lowercase letters and digitsRandomToken.ALPHA: uppercase/lowercase lettersRandomToken.LOWERCASE_DIGIT: lowercase letters and digitsRandomToken.UPPERCASE_DIGIT: uppercase letters and digitsRandomToken.LOWERCASE: lowercase lettersRandomToken.UPPERCASE: uppercase lettersRandomToken.HEX: hexadecimal letters and digitsRandomToken.DIGIT: only digits
- Returns:
- a reference of this object.
- Throws:
overit.geocall.asserts.AssertsException- if the alphabet is null or empty.
-
anonymize
Set a random string as value of the field assigned to this instance. The length of the generated string will be the same as the one specified by the size parameter.- Parameters:
alphabet- String containing the characters that will be used to generate the random string. Typically you can use these predefined set of alphabet:RandomToken.ALPHA_DIGIT: uppercase/lowercase letters and digitsRandomToken.ALPHA: uppercase/lowercase lettersRandomToken.LOWERCASE_DIGIT: lowercase letters and digitsRandomToken.UPPERCASE_DIGIT: uppercase letters and digitsRandomToken.LOWERCASE: lowercase lettersRandomToken.UPPERCASE: uppercase lettersRandomToken.HEX: hexadecimal letters and digitsRandomToken.DIGIT: only digits
size- positive number indicating length of the generated string.- Returns:
- a reference of this object.
- Throws:
overit.geocall.asserts.AssertsException- if the alphabet is null or empty, or if the size is negative.
-
anonymize
-