Package org.approvej.json.jackson
Class JsonPointerScrubber
java.lang.Object
org.approvej.json.jackson.JsonPointerScrubber
- All Implemented Interfaces:
Function<com.fasterxml.jackson.databind.JsonNode,
,com.fasterxml.jackson.databind.JsonNode> UnaryOperator<com.fasterxml.jackson.databind.JsonNode>
,org.approvej.scrub.Scrubber<com.fasterxml.jackson.databind.JsonNode>
@NullMarked
public class JsonPointerScrubber
extends Object
implements org.approvej.scrub.Scrubber<com.fasterxml.jackson.databind.JsonNode>
A
Scrubber
that scrubs a JSON node at a specific JsonPointer
by replacing its-
Method Summary
Modifier and TypeMethodDescriptioncom.fasterxml.jackson.databind.JsonNode
apply
(com.fasterxml.jackson.databind.JsonNode unscrubbedJsonNode) static JsonPointerScrubber
jsonPointer
(String jsonPointerString) replacement
(String staticReplacement) Creates a newScrubber
to replace any match of thejsonPointer
with the given static replacement.replacement
(Function<Integer, Object> replacement) Create aScrubber
to replace any match of thejsonPointer
with the result of the given replacementFunction
.
-
Method Details
-
jsonPointer
- Parameters:
jsonPointerString
- aString
compilable to aJsonPointer
to be replaced- Returns:
- a new
JsonPointerScrubber
- See Also:
-
apply
public com.fasterxml.jackson.databind.JsonNode apply(com.fasterxml.jackson.databind.JsonNode unscrubbedJsonNode) -
replacement
Create aScrubber
to replace any match of thejsonPointer
with the result of the given replacementFunction
.- Parameters:
replacement
- a function that receives the finding index and returns the replacement string- Returns:
- a
JsonPointerScrubber
to replace any match of thejsonPointer
with the result of the given replacementFunction
.
-
replacement
Creates a newScrubber
to replace any match of thejsonPointer
with the given static replacement.- Parameters:
staticReplacement
- the static replacementString
- Returns:
- a new
JsonPointerScrubber
to replace any match of thejsonPointer
with the given staticReplacement.
-