org.codehaus.cargo.module.merge.tagstrategy
Class NodeMergeStrategy

java.lang.Object
  extended by 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.

Version:
$Id $

Constructor Summary
NodeMergeStrategy(DescriptorType type, org.jdom.Element template)
          Constructor.
NodeMergeStrategy(DescriptorType type, InputStream stream)
          Constructor.
 
Method Summary
 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 left descriptor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeMergeStrategy

public NodeMergeStrategy(DescriptorType type,
                         org.jdom.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.jdom.JDOMException
Constructor.

Parameters:
type - Descriptor Type
stream - content input stream
Throws:
IOException - if IO Exception
org.jdom.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
See Also:
org.codehaus.cargo.module.merge.DescriptorMergerByTag.MergeStrategy#inBoth(org.codehaus.cargo.module.Descriptor, org.codehaus.cargo.module.DescriptorElement, org.codehaus.cargo.module.DescriptorElement)

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
See Also:
org.codehaus.cargo.module.merge.DescriptorMergerByTag.MergeStrategy#inLeft(org.codehaus.cargo.module.Descriptor, org.codehaus.cargo.module.DescriptorElement)

inRight

public int inRight(Descriptor target,
                   DescriptorElement right)
Process when the element appears just in the left descriptor.

Specified by:
inRight in interface MergeStrategy
Parameters:
target - output descriptor
right - right element
Returns:
count of merged elements
See Also:
org.codehaus.cargo.module.merge.DescriptorMergerByTag.MergeStrategy#inRight(org.codehaus.cargo.module.Descriptor, org.codehaus.cargo.module.DescriptorElement)


Copyright © 2004-2012 Codehaus. All Rights Reserved.