Class ExtendsProcessor
java.lang.Object
org.metricshub.maven.plugin.connector.parser.AbstractNodeProcessor
org.metricshub.maven.plugin.connector.parser.ExtendsProcessor
The
ExtendsProcessor class performs the merging of extended connectors.
This processor is designed to handle the merging of extended connectors specified under the "extends" section
of a given JSON node. The merging process involves recursively combining extended connectors and the provided
JSON node. The merging logic is implemented in the doMerge(JsonNode) method.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionExtendsProcessor(Path connectorDirectory, AbstractNodeProcessor next) Constructs a new instance of ExtendsProcessor with the specified connector directory, YAML ObjectMapper, and optional next processor. -
Method Summary
Modifier and TypeMethodDescriptionstatic com.fasterxml.jackson.databind.JsonNodemerge(com.fasterxml.jackson.databind.JsonNode mainNode, com.fasterxml.jackson.databind.JsonNode updateNode) Merge the given mainNode and updateNode.com.fasterxml.jackson.databind.JsonNodeprocessNode(com.fasterxml.jackson.databind.JsonNode node) Methods inherited from class org.metricshub.maven.plugin.connector.parser.AbstractNodeProcessor
process
-
Constructor Details
-
ExtendsProcessor
Constructs a new instance of ExtendsProcessor with the specified connector directory, YAML ObjectMapper, and optional next processor.- Parameters:
connectorDirectory- The directory path for connectors.next- The next processor in the processing chain.
-
-
Method Details
-
processNode
public com.fasterxml.jackson.databind.JsonNode processNode(com.fasterxml.jackson.databind.JsonNode node) throws IOException - Throws:
IOException
-
merge
public static com.fasterxml.jackson.databind.JsonNode merge(com.fasterxml.jackson.databind.JsonNode mainNode, com.fasterxml.jackson.databind.JsonNode updateNode) Merge the given mainNode and updateNode. Merge strategy:
- Arrays of objects are appended from
updateNodetomainNode. - Arrays of simple values from
updateNodeerase the ones inmainNode. updateNodeobject values overwritemainNodeobject values.
- Parameters:
mainNode- The main JsonNode to be merged.updateNode- The JsonNode containing updates to be merged into the mainNode.- Returns:
JsonNodemerged
- Arrays of objects are appended from
-