Class NodeMergeStrategy

  • All Implemented Interfaces:
    MergeStrategy

    public class NodeMergeStrategy
    extends Object
    implements MergeStrategy
    A merging strategy that can be used to combine two XML documents together.
    • Constructor Detail

      • NodeMergeStrategy

        public NodeMergeStrategy​(DescriptorType type,
                                 org.jdom2.Element template)
        Constructor.
        Parameters:
        type - the descriptor type
        template - in the template to use in the merge
      • NodeMergeStrategy

        public NodeMergeStrategy​(DescriptorType type,
                                 InputStream stream)
                          throws IOException,
                                 org.jdom2.JDOMException
        Constructor.
        Parameters:
        type - Descriptor Type
        stream - content input stream
        Throws:
        IOException - if IO Exception
        org.jdom2.JDOMException - if parser error
    • Method Detail

      • inBoth

        public int inBoth​(Descriptor target,
                          DescriptorElement left,
                          DescriptorElement right)
        Process when the element appears in both descriptors.
        Specified by:
        inBoth in interface MergeStrategy
        Parameters:
        target - output descriptor
        left - left element
        right - right element
        Returns:
        count of merged elements
      • inLeft

        public int inLeft​(Descriptor target,
                          DescriptorElement left)
        Process when the element appears just in the left descriptor.
        Specified by:
        inLeft in interface MergeStrategy
        Parameters:
        target - output descriptor
        left - left element
        Returns:
        count of merged elements
      • inRight

        public int inRight​(Descriptor target,
                           DescriptorElement right)
        Process when the element appears just in the right descriptor.
        Specified by:
        inRight in interface MergeStrategy
        Parameters:
        target - output descriptor
        right - right element
        Returns:
        count of merged elements