org.broadleafcommerce.common.extensibility.context.merge.handlers
Class MergeHandlerAdapter

java.lang.Object
  extended by org.broadleafcommerce.common.extensibility.context.merge.handlers.MergeHandlerAdapter
All Implemented Interfaces:
MergeHandler

public class MergeHandlerAdapter
extends Object
implements MergeHandler

This adapter class allows the developer to create a merge handler instance and only override a subset of the functionality, instead of having to provide an independent, full implementation of the MergeHandler interface.

Author:
jfischer

Constructor Summary
MergeHandlerAdapter()
           
 
Method Summary
 MergeHandler[] getChildren()
          Retrieve any child merge handlers associated with this handler.
 String getName()
          Retrieve the name associated with this merge handlers.
 int getPriority()
          Retrieve the priority for the handler.
 String getXPath()
          Retrieve the XPath query associated with this handler.
 Node[] merge(NodeList nodeList1, NodeList nodeList2, List<Node> exhaustedNodes)
          Perform the merge using the supplied list of nodes from the source and patch documents, respectively.
 void setChildren(MergeHandler[] children)
          Set the child merge handlers
 void setName(String name)
          Set the period-delimited numeric string that names this handler
 void setPriority(int priority)
          Set the priority for this handler
 void setXPath(String xpath)
          Set the xpath query
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MergeHandlerAdapter

public MergeHandlerAdapter()
Method Detail

getChildren

public MergeHandler[] getChildren()
Description copied from interface: MergeHandler
Retrieve any child merge handlers associated with this handler. Child merge handlers may be added alter merge behavior for a subsection of the merge area defined by this merge handler.

Specified by:
getChildren in interface MergeHandler
Returns:
child merge handlers

getName

public String getName()
Description copied from interface: MergeHandler
Retrieve the name associated with this merge handlers. Merge handler names are period-delimited numeric strings that define the hierarchical relationship of mergehandlers and their children. For example, "2" could be used to define the second handler in the configuration list and "2.1" would be the name describing the first child handler of "2".

Specified by:
getName in interface MergeHandler
Returns:
the period-delimited numeric string that names this handler

getPriority

public int getPriority()
Description copied from interface: MergeHandler
Retrieve the priority for the handler. Priorities are used by the MergeManager to establish the order of operations for performing merges.

Specified by:
getPriority in interface MergeHandler
Returns:
the priority value

getXPath

public String getXPath()
Description copied from interface: MergeHandler
Retrieve the XPath query associated with this handler. XPath is used by the handler to define to section of the source and patch documents that will be merged.

Specified by:
getXPath in interface MergeHandler
Returns:
the xpath query

merge

public Node[] merge(NodeList nodeList1,
                    NodeList nodeList2,
                    List<Node> exhaustedNodes)
Description copied from interface: MergeHandler
Perform the merge using the supplied list of nodes from the source and patch documents, respectively. Also, a list of nodes that have already been merged is provided and may be used by the implementation when necessary.

Specified by:
merge in interface MergeHandler
Parameters:
nodeList1 - list of nodes to be merged from the source document
nodeList2 - list of nodes to be merged form the patch document
exhaustedNodes - already merged nodes
Returns:
list of merged nodes

setChildren

public void setChildren(MergeHandler[] children)
Description copied from interface: MergeHandler
Set the child merge handlers

Specified by:
setChildren in interface MergeHandler

setName

public void setName(String name)
Description copied from interface: MergeHandler
Set the period-delimited numeric string that names this handler

Specified by:
setName in interface MergeHandler

setPriority

public void setPriority(int priority)
Description copied from interface: MergeHandler
Set the priority for this handler

Specified by:
setPriority in interface MergeHandler

setXPath

public void setXPath(String xpath)
Description copied from interface: MergeHandler
Set the xpath query

Specified by:
setXPath in interface MergeHandler


Copyright © 2012. All Rights Reserved.