public class CorrelatedColumnsSanitizer extends Object implements ValueSanitizer
| Constructor and Description |
|---|
CorrelatedColumnsSanitizer(String[][] components,
Function<Object[],Object> defaultValueBuilder)
{
{ "elvis", "chuck" }, // component 1
{ "norris", "presely" }, // component 2
{ "mymail.com", "music.com" }, // component 3
...
|
| Modifier and Type | Method and Description |
|---|---|
void |
addColumn(String columnName,
Function<Object[],Object> valueBuilder)
add a column, along with a rule how to build its value, given random components.
|
Object |
sanitize(Object originalValue,
String rowId,
String propertyName)
sanitizes an originalValue, which is potentially sensitive, to a sanitized version, which
is not sensitive
|
public CorrelatedColumnsSanitizer(String[][] components, Function<Object[],Object> defaultValueBuilder)
{
{ "elvis", "chuck" }, // component 1
{ "norris", "presely" }, // component 2
{ "mymail.com", "music.com" }, // component 3
...
}
components - array of component arraysdefaultValueBuilder - result builder function for columns not specifically added via
addColumn, can be nullpublic void addColumn(String columnName, Function<Object[],Object> valueBuilder)
// chuck.norris@mymail.com, elvis.presley@music.com, ...
myCorrelatatedColSan.addColumn("email", c -> c[0] + "." + c[1] + "@" + c[2]
columnName - column namevalueBuilder - function to build the column value given n random components; use null for
default whitespace-separated concatenationpublic Object sanitize(Object originalValue, String rowId, String propertyName)
ValueSanitizersanitize in interface ValueSanitizeroriginalValue - original value, which may be sensitiverowId - if available, unique id identifying the row on which this value sitspropertyName - name of the propertyCopyright © 2021. All rights reserved.