Class DefaultXmlService

java.lang.Object
org.apache.maven.api.xml.XmlService
org.apache.maven.internal.xml.DefaultXmlService

public class DefaultXmlService extends org.apache.maven.api.xml.XmlService
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.maven.api.xml.XmlService

    org.apache.maven.api.xml.XmlService.InputLocationBuilder
  • Field Summary

    Fields inherited from class org.apache.maven.api.xml.XmlService

    CHILDREN_COMBINATION_APPEND, CHILDREN_COMBINATION_MERGE, CHILDREN_COMBINATION_MODE_ATTRIBUTE, DEFAULT_CHILDREN_COMBINATION_MODE, DEFAULT_SELF_COMBINATION_MODE, ID_COMBINATION_MODE_ATTRIBUTE, KEYS_COMBINATION_MODE_ATTRIBUTE, SELF_COMBINATION_MERGE, SELF_COMBINATION_MODE_ATTRIBUTE, SELF_COMBINATION_OVERRIDE, SELF_COMBINATION_REMOVE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.maven.api.xml.XmlNode
    doMerge(org.apache.maven.api.xml.XmlNode dominant, org.apache.maven.api.xml.XmlNode recessive, Boolean childMergeOverride)
    Merges one DOM into another, given a specific algorithm and possible override points for that algorithm.
    org.apache.maven.api.xml.XmlNode
    doRead(InputStream input, org.apache.maven.api.xml.XmlService.InputLocationBuilder locationBuilder)
     
    org.apache.maven.api.xml.XmlNode
    doRead(Reader reader, org.apache.maven.api.xml.XmlService.InputLocationBuilder locationBuilder)
     
    org.apache.maven.api.xml.XmlNode
    doRead(XMLStreamReader parser, org.apache.maven.api.xml.XmlService.InputLocationBuilder locationBuilder)
     
    void
    doWrite(org.apache.maven.api.xml.XmlNode node, Writer writer)
     

    Methods inherited from class org.apache.maven.api.xml.XmlService

    merge, merge, read, read, read, read, read, write

    Methods inherited from class Object

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

    • DefaultXmlService

      public DefaultXmlService()
  • Method Details

    • doRead

      @Nonnull public org.apache.maven.api.xml.XmlNode doRead(InputStream input, @Nullable org.apache.maven.api.xml.XmlService.InputLocationBuilder locationBuilder) throws XMLStreamException
      Specified by:
      doRead in class org.apache.maven.api.xml.XmlService
      Throws:
      XMLStreamException
    • doRead

      @Nonnull public org.apache.maven.api.xml.XmlNode doRead(Reader reader, @Nullable org.apache.maven.api.xml.XmlService.InputLocationBuilder locationBuilder) throws XMLStreamException
      Specified by:
      doRead in class org.apache.maven.api.xml.XmlService
      Throws:
      XMLStreamException
    • doRead

      @Nonnull public org.apache.maven.api.xml.XmlNode doRead(XMLStreamReader parser, @Nullable org.apache.maven.api.xml.XmlService.InputLocationBuilder locationBuilder) throws XMLStreamException
      Specified by:
      doRead in class org.apache.maven.api.xml.XmlService
      Throws:
      XMLStreamException
    • doWrite

      public void doWrite(org.apache.maven.api.xml.XmlNode node, Writer writer) throws IOException
      Specified by:
      doWrite in class org.apache.maven.api.xml.XmlService
      Throws:
      IOException
    • doMerge

      public org.apache.maven.api.xml.XmlNode doMerge(org.apache.maven.api.xml.XmlNode dominant, org.apache.maven.api.xml.XmlNode recessive, Boolean childMergeOverride)
      Merges one DOM into another, given a specific algorithm and possible override points for that algorithm.

      The algorithm is as follows:

      1. if the recessive DOM is null, there is nothing to do... return.
      2. Determine whether the dominant node will suppress the recessive one (flag=mergeSelf).
        1. retrieve the 'combine.self' attribute on the dominant node, and try to match against 'override'... if it matches 'override', then set mergeSelf == false...the dominant node suppresses the recessive one completely.
        2. otherwise, use the default value for mergeSelf, which is true...this is the same as specifying 'combine.self' == 'merge' as an attribute of the dominant root node.
      3. If mergeSelf == true
        1. Determine whether children from the recessive DOM will be merged or appended to the dominant DOM as siblings (flag=mergeChildren).
          1. if childMergeOverride is set (non-null), use that value (true/false)
          2. retrieve the 'combine.children' attribute on the dominant node, and try to match against 'append'...
          3. if it matches 'append', then set mergeChildren == false...the recessive children will be appended as siblings of the dominant children.
          4. otherwise, use the default value for mergeChildren, which is true...this is the same as specifying 'combine.children' == 'merge' as an attribute on the dominant root node.
        2. Iterate through the recessive children, and:
          1. if mergeChildren == true and there is a corresponding dominant child (matched by element name), merge the two.
          2. otherwise, add the recessive child as a new child on the dominant root node.
      Specified by:
      doMerge in class org.apache.maven.api.xml.XmlService