java.lang.Object
org.sentrysoftware.maven.metricshub.connector.parser.AbstractNodeProcessor
org.sentrysoftware.maven.metricshub.connector.parser.ExtendsProcessor

public class ExtendsProcessor extends AbstractNodeProcessor
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

    Constructors
    Constructor
    Description
    ExtendsProcessor(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 Type
    Method
    Description
    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.
    com.fasterxml.jackson.databind.JsonNode
    processNode(com.fasterxml.jackson.databind.JsonNode node)
     

    Methods inherited from class org.sentrysoftware.maven.metricshub.connector.parser.AbstractNodeProcessor

    process

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ExtendsProcessor

      public ExtendsProcessor(Path connectorDirectory, AbstractNodeProcessor next)
      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:
      1. Arrays of objects are appended from updateNode to mainNode.
      2. Arrays of simple values from updateNode erase the ones in mainNode.
      3. updateNode object values overwrite mainNode object values.
      Parameters:
      mainNode - The main JsonNode to be merged.
      updateNode - The JsonNode containing updates to be merged into the mainNode.
      Returns:
      JsonNode merged