at.ac.tuwien.infosys.sm4all.copal.api.xml
Class InsertBefore

java.lang.Object
  extended by at.ac.tuwien.infosys.sm4all.copal.api.xml.InsertBefore
All Implemented Interfaces:
AddStrategy

public class InsertBefore
extends Object
implements AddStrategy

Strategy class for inserting one Element before another Element.

Author:
sanjin

Constructor Summary
InsertBefore(String siblingName, AddStrategy onFailStrategy)
          Creates instance of insert-before AddStrategy that will insert Elements before an Element with specified local name.
 
Method Summary
 void add(Element parent, Element child)
          Inserts specified child Element into specified parent Element before an Element with specified namespace URI and local name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InsertBefore

public InsertBefore(String siblingName,
                    AddStrategy onFailStrategy)
Creates instance of insert-before AddStrategy that will insert Elements before an Element with specified local name. If such Element cannot be found then the specified on-fail AddStrategy is called.

Parameters:
siblingName - the local name of the sibling Element.
onFailStrategy - the on-fail AddStrategy.
Throws:
NullPointerException - if specified sibling name or on-fail AddStrategy is null.
IllegalArgumentException - if specified sibling name is an empty or blank string.
Method Detail

add

public void add(Element parent,
                Element child)
Inserts specified child Element into specified parent Element before an Element with specified namespace URI and local name. If such Element cannot be found then the specified on-fail AddStrategy is called.

Specified by:
add in interface AddStrategy
Parameters:
parent - the parent Element.
child - the child Element.
Throws:
NullPointerException - if parent or child Element is null.


Copyright © 2010 Distributed Systems Group, Vienna University of Technology. All Rights Reserved.