Class JsonNodeContextUpdater
java.lang.Object
org.sentrysoftware.metricshub.engine.connector.parser.AbstractJsonNodeUpdater
org.sentrysoftware.metricshub.engine.connector.parser.JsonNodeContextUpdater
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 Summary
ConstructorsConstructorDescriptionJsonNodeContextUpdater(@NonNull com.fasterxml.jackson.databind.JsonNode jsonNode, @NonNull Predicate<String> predicate, @NonNull BinaryOperator<String> updater) Constructs a new instance of theJsonNodeContextUpdater. -
Method Summary
Modifier and TypeMethodDescriptionvoidupdate()Traverse the current JsonNode, applying the updater to each JsonNode child when the predicate evaluates to true, indicating that 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 theJsonNodeContextUpdater.- Parameters:
jsonNode-JsonNodeobject 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.
-