Class ExtendsProcessor
java.lang.Object
org.sentrysoftware.maven.metricshub.connector.parser.AbstractNodeProcessor
org.sentrysoftware.maven.metricshub.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
ConstructorDescriptionExtendsProcessor
(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.JsonNode
merge
(com.fasterxml.jackson.databind.JsonNode mainNode, com.fasterxml.jackson.databind.JsonNode updateNode) Merge the given mainNode and updateNode.com.fasterxml.jackson.databind.JsonNode
processNode
(com.fasterxml.jackson.databind.JsonNode node) Methods inherited from class org.sentrysoftware.maven.metricshub.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
updateNode
tomainNode
. - Arrays of simple values from
updateNode
erase the ones inmainNode
. updateNode
object values overwritemainNode
object values.
- Parameters:
mainNode
- The main JsonNode to be merged.updateNode
- The JsonNode containing updates to be merged into the mainNode.- Returns:
JsonNode
merged
- Arrays of objects are appended from
-