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 Details

    • jsonPointer

      public static JsonPointerScrubber jsonPointer(String jsonPointerString)
      Create a JsonPointerScrubber to replace the JSON node at the given JsonPointer String.
      Parameters:
      jsonPointerString - a String compilable to a JsonPointer to be replaced
      Returns:
      a new JsonPointerScrubber
      See Also:
      • JsonPointer.compile(String)
    • apply

      public com.fasterxml.jackson.databind.JsonNode apply(com.fasterxml.jackson.databind.JsonNode unscrubbedJsonNode)
      Specified by:
      apply in interface Function<com.fasterxml.jackson.databind.JsonNode,com.fasterxml.jackson.databind.JsonNode>
    • replacement

      public JsonPointerScrubber replacement(Function<Integer,Object> replacement)
      Create a Scrubber to replace any match of the jsonPointer with the result of the given replacement Function.
      Parameters:
      replacement - a function that receives the finding index and returns the replacement string
      Returns:
      a JsonPointerScrubber to replace any match of the jsonPointer with the result of the given replacement Function.
    • replacement

      public JsonPointerScrubber replacement(String staticReplacement)
      Creates a new Scrubber to replace any match of the jsonPointer with the given static replacement.
      Parameters:
      staticReplacement - the static replacement String
      Returns:
      a new JsonPointerScrubber to replace any match of the jsonPointer with the given staticReplacement.