public class RegexValueMasker extends Object implements ValueMasker
Constructor and Description |
---|
RegexValueMasker(Pattern pattern,
Object mask) |
RegexValueMasker(String regex,
Object mask) |
Modifier and Type | Method and Description |
---|---|
Object |
mask(JsonStreamContext context,
Object o)
If the given value at the JSON stream context's current path should be masked,
then returns the masked value to write as the value..
|
public RegexValueMasker(String regex, Object mask)
regex
- the regex used to identify values to maskmask
- the value to write for values that match the regex (can contain back references to capture groups in the regex)public Object mask(JsonStreamContext context, Object o)
ValueMasker
MaskingJsonGenerator
will write the returned masked value
as the value (instead of the original value).
If the given value at the JSON stream context's current path should NOT be masked, returns null.
mask
in interface ValueMasker
context
- the current JSON stream context, which can be used to determine the path within the JSON output.
(could be at a field value path or an array element value path)o
- the number or string scalar value to potentially mask (could be a field value or an array element value).NullNode.instance
.
To write , the return MaskingJsonGenerator.MASK
Copyright © 2020. All rights reserved.