Package org.approvej.scrub
Class UuidScrubber
java.lang.Object
org.approvej.scrub.UuidScrubber
Scrubs a
String by replacing all occurrences UUIDs.
E.g.
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"other-id": "123e4567-e89b-12d3-a456-426614174001",
"same-id": "123e4567-e89b-12d3-a456-426614174000"
}
Will be scrubbed to
{
"id": "[uuid 1]",
"other-id": "[uuid 2]",
"same-id": "[uuid 1]"
}
-
Field Summary
FieldsModifier and TypeFieldDescriptionReplaces each match with "[uuid #]" where '#' is the number of the distinct found string. -
Method Summary
Modifier and TypeMethodDescriptionstatic RegexScrubberuuids()Creates a newRegexScrubberusing theNUMBERED_REPLACEMENT.static RegexScrubberCreates a newRegexScrubberusing the givenreplacementfunction.
-
Field Details
-
NUMBERED_REPLACEMENT
Replaces each match with "[uuid #]" where '#' is the number of the distinct found string.
-
-
Method Details
-
uuids
Creates a newRegexScrubberusing the givenreplacementfunction.- Parameters:
replacement- a custom replacement function that takes the number of the match as an argument- Returns:
- a RegexScrubber that replaces all UUIDs with the given replacement
-
uuids
Creates a newRegexScrubberusing theNUMBERED_REPLACEMENT.- Returns:
- a RegexScrubber that replaces all UUIDs with a numbered placeholder
-