org.vmguys.vmtools.utils
Class JdomPatcher

java.lang.Object
  |
  +--org.vmguys.vmtools.utils.JdomPatcher

public class JdomPatcher
extends java.lang.Object

This class takes a set of patch instructions that are in a JDOM tree or a List and applies them to a JDOM tree.


Constructor Summary
JdomPatcher()
          Constructs a JdomPatcher using the namespace of NO_NAMESPACE.
JdomPatcher(org.jdom.Namespace namespace)
          Constructs a JdomPatcher with the specified namespace.
JdomPatcher(org.jdom.Namespace namespace, boolean discardWhitespace)
          Constructs a JdomPatcher with the specified namespace and setting for discardWhitespace.
JdomPatcher(org.jdom.Namespace namespace, boolean discardWhitespace, boolean addComments)
          Constructs a JdomPatcher with the specified namespace, setting for discardWhitespace, and setting for addComments.
 
Method Summary
 boolean isDiscardWhitespace()
          Getter for property discardWhitespace.
 org.jdom.Element patch(org.jdom.Element originalTree, org.jdom.Element patchTree)
          Applies patches to a JDOM tree and returns the modified tree.
 org.jdom.Element patch(org.jdom.Element originalTree, java.util.List patchList)
          Applies patches to a JDOM tree and returns the modified tree.
 void setDiscardWhitespace(boolean discardWhitespace)
          Setter for property discardWhitespace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdomPatcher

public JdomPatcher()
Constructs a JdomPatcher using the namespace of NO_NAMESPACE. The discardWhitespace property will be set true, and the addComments property will be set false.

JdomPatcher

public JdomPatcher(org.jdom.Namespace namespace)
Constructs a JdomPatcher with the specified namespace. The discardWhitespace property will be set true, and the addComments property will be set false.

JdomPatcher

public JdomPatcher(org.jdom.Namespace namespace,
                   boolean discardWhitespace)
Constructs a JdomPatcher with the specified namespace and setting for discardWhitespace. The addComments property will be set false.

JdomPatcher

public JdomPatcher(org.jdom.Namespace namespace,
                   boolean discardWhitespace,
                   boolean addComments)
Constructs a JdomPatcher with the specified namespace, setting for discardWhitespace, and setting for addComments. If addComments is true, comments will be added to the output indicating the reason for each operation. This is most useful for debugging or tracing the operations.
Method Detail

patch

public org.jdom.Element patch(org.jdom.Element originalTree,
                              org.jdom.Element patchTree)
                       throws org.jdom.JDOMException
Applies patches to a JDOM tree and returns the modified tree. The original tree is cloned before the patches are applied, so it is unchanged.

patch

public org.jdom.Element patch(org.jdom.Element originalTree,
                              java.util.List patchList)
                       throws org.jdom.JDOMException
Applies patches to a JDOM tree and returns the modified tree. The original tree is cloned before the patches are applied, so it is unchanged. The patchList should be a List of Elements. This is available in case there is a need to detach the children from the root of the patch tree.

isDiscardWhitespace

public boolean isDiscardWhitespace()
Getter for property discardWhitespace.
Returns:
Value of property discardWhitespace.

setDiscardWhitespace

public void setDiscardWhitespace(boolean discardWhitespace)
Setter for property discardWhitespace.
Parameters:
discardWhitespace - New value of property discardWhitespace.


Copyright © 2001 VM Systems, Inc. All Rights Reserved.