Class NodeMergeStrategy
- java.lang.Object
-
- org.codehaus.cargo.module.merge.tagstrategy.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 Summary
Constructors Constructor Description NodeMergeStrategy(DescriptorType type, InputStream stream)
Constructor.NodeMergeStrategy(DescriptorType type, org.jdom2.Element template)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
inBoth(Descriptor target, DescriptorElement left, DescriptorElement right)
Process when the element appears in both descriptors.int
inLeft(Descriptor target, DescriptorElement left)
Process when the element appears just in the left descriptor.int
inRight(Descriptor target, DescriptorElement right)
Process when the element appears just in the right descriptor.
-
-
-
Constructor Detail
-
NodeMergeStrategy
public NodeMergeStrategy(DescriptorType type, org.jdom2.Element template)
Constructor.- Parameters:
type
- the descriptor typetemplate
- in the template to use in the merge
-
NodeMergeStrategy
public NodeMergeStrategy(DescriptorType type, InputStream stream) throws IOException, org.jdom2.JDOMException
Constructor.- Parameters:
type
- Descriptor Typestream
- content input stream- Throws:
IOException
- if IO Exceptionorg.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 interfaceMergeStrategy
- Parameters:
target
- output descriptorleft
- left elementright
- 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 interfaceMergeStrategy
- Parameters:
target
- output descriptorleft
- 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 interfaceMergeStrategy
- Parameters:
target
- output descriptorright
- right element- Returns:
- count of merged elements
-
-