Class TemplateVariableProcessor
java.lang.Object
org.sentrysoftware.metricshub.engine.connector.parser.AbstractNodeProcessor
org.sentrysoftware.metricshub.engine.connector.parser.TemplateVariableProcessor
Processes template variables within JSON nodes by substituting placeholders
with actual values from a set of connector variables. This processor extends
the
AbstractNodeProcessor to allow for chained node processing in the
context of JSON data parsing and manipulation within the MetricsHub Engine.
It leverages regular expressions to identify placeholders matching a specific pattern and replaces them with corresponding values provided in a map of connector variables. This mechanism facilitates dynamic data manipulation based on the configuration provided at runtime.
-
Constructor Summary
ConstructorsConstructorDescriptionTemplateVariableProcessor(@NonNull Map<String, String> connectorVariables, AbstractNodeProcessor next) Constructs a newTemplateVariableProcessorwith the specified map of connector variables and the next processor in the chain. -
Method Summary
Modifier and TypeMethodDescriptioncom.fasterxml.jackson.databind.JsonNodeprocessNode(com.fasterxml.jackson.databind.JsonNode node) Processes a given Json node by callingJsonNodeUpdaterMethods inherited from class org.sentrysoftware.metricshub.engine.connector.parser.AbstractNodeProcessor
process
-
Constructor Details
-
TemplateVariableProcessor
public TemplateVariableProcessor(@NonNull @NonNull Map<String, String> connectorVariables, AbstractNodeProcessor next) Constructs a newTemplateVariableProcessorwith the specified map of connector variables and the next processor in the chain. This constructor initializes the processor with a set of key-value pairs representing the variables to be substituted within JSON templates and optionally, a nextAbstractNodeProcessorfor further processing.
-
-
Method Details
-
processNode
public com.fasterxml.jackson.databind.JsonNode processNode(com.fasterxml.jackson.databind.JsonNode node) throws IOException Processes a given Json node by callingJsonNodeUpdater- Parameters:
node- The input Json node.- Returns:
- The processed Json node.
- Throws:
IOException- thrown byAbstractNodeProcessor
-