Class JsonNodeContextUpdater

java.lang.Object
org.sentrysoftware.metricshub.engine.connector.parser.AbstractJsonNodeUpdater
org.sentrysoftware.metricshub.engine.connector.parser.JsonNodeContextUpdater

public class JsonNodeContextUpdater extends AbstractJsonNodeUpdater
This utility class traverses a JsonNode using a path context, applying updates according to an updater function and a predicate that determines whether the value should be updated.
  • Constructor Details

    • JsonNodeContextUpdater

      public JsonNodeContextUpdater(@NonNull @NonNull com.fasterxml.jackson.databind.JsonNode jsonNode, @NonNull @NonNull Predicate<String> predicate, @NonNull @NonNull BinaryOperator<String> updater)
      Constructs a new instance of the JsonNodeContextUpdater.
      Parameters:
      jsonNode - JsonNode object to update.
      predicate - Update condition function.
      updater - Function performing an update of a string value using a current context.
  • Method Details

    • update

      public void update()
      Traverse the current JsonNode, applying the updater to each JsonNode child when the predicate evaluates to true, indicating that the value should be updated.