Package org.codehaus.cargo.module.merge
Class DocumentMerger
- java.lang.Object
-
- org.codehaus.cargo.module.merge.DocumentMerger
-
- All Implemented Interfaces:
MergeProcessor
public class DocumentMerger extends Object implements MergeProcessor
Class that can merge two DOM Documents, relatively simply. This works by just importing all the child nodes from the right-hand document into the left-hand document.
Create theDocumentMerger
, then calladdMergeItem
successive times withDocument
s. Finally callperformMerge()
, which will return you the merged DOM Document.
This class may be overridden by subclasses that wish to apply strategies to particular types of XML document.
-
-
Constructor Summary
Constructors Constructor Description DocumentMerger()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMergeItem(Object mergeItem)
Add an item to be merged.Object
performMerge()
Perform the merge.
-
-
-
Method Detail
-
addMergeItem
public void addMergeItem(Object mergeItem) throws MergeException
Add an item to be merged.- Specified by:
addMergeItem
in interfaceMergeProcessor
- Parameters:
mergeItem
- in the item to merge.- Throws:
MergeException
- on exceptions
-
performMerge
public Object performMerge()
Perform the merge.- Specified by:
performMerge
in interfaceMergeProcessor
- Returns:
- the merged artifact
-
-