org.eclipse.webdav.dom
Class HrefSet

java.lang.Object
  extended by org.eclipse.webdav.dom.ElementEditor
      extended by org.eclipse.webdav.dom.HrefSet

public class HrefSet
extends ElementEditor

An element editor for sets of hrefs, for example, the WebDAV predecessor-set element.

Note: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.


Field Summary
 
Fields inherited from class org.eclipse.webdav.dom.ElementEditor
DAV_NS, root, XML_NS_NAME, XML_NS_PREFIX, XML_PREFIX
 
Constructor Summary
HrefSet(Element root, QualifiedName name)
          Creates a new editor on the given href set element with the given name.
 
Method Summary
 void addHref(String href)
          Adds the given href to the end of the set of hrefs.
static HrefSet create(Document document, QualifiedName name)
          Creates a new href set element with the given name and sets it as the root of the given document.
 Enumeration getHrefs()
          Returns an Enumeration over the set of hrefs.
 void insertHrefAfter(String refHref, String newHref)
          Inserts the given newHref after the given refHref in the set of hrefs.
 void insertHrefBefore(String newHref, String refHref)
          Inserts the given newHref before the given refHref in the set of hrefs.
protected  boolean isDuplicate(String encodedHref)
           
 void removeHref(String href)
          Remove the given href from the set of hrefs.
 
Methods inherited from class org.eclipse.webdav.dom.ElementEditor
addChild, addChild, addChild, appendChild, appendChild, cloneNode, create, declareNS, decodeHref, encodeHref, ensure, ensure, ensureDAVElement, ensureDAVElement, ensureNotNull, ensureNull, ensureText, extractElement, extractNode, getChild, getChildElement, getChildText, getDAVChild, getElement, getFirstChild, getFirstChild, getFirstText, getLastChild, getNamespaces, getNamespaces, getNextSibling, getNextSibling, getNextSibling, getNSLocalName, getNSLocalName, getNSName, getNSPrefix, getNSPrefix, getQualifiedName, getSibling, getText, getTwin, hasChild, insertBefore, insertBefore, isDAVElement, isDAVElement, isElement, isText, makeNSStandalone, reduceNS, reduceNS, resolve, setChild, setChild, setChild
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HrefSet

public HrefSet(Element root,
               QualifiedName name)
        throws MalformedElementException
Creates a new editor on the given href set element with the given name. The element is assumed to be well formed.

Parameters:
root - an href element
name - the name of the element that this editor is expected to manipulate.
Throws:
MalformedElementException - if there is reason to believe that the element is not well formed
Method Detail

addHref

public void addHref(String href)
Adds the given href to the end of the set of hrefs. If the href already exists it is not added.

Parameters:
href - the href to add to the end of the set of hrefs

create

public static HrefSet create(Document document,
                             QualifiedName name)
Creates a new href set element with the given name and sets it as the root of the given document. Returns an editor on the new href set element. The document must not be null, and must not already have a root element.

Parameters:
document - the document that will become the root of a new href set element
Returns:
an element editor on a href set element

getHrefs

public Enumeration getHrefs()
Returns an Enumeration over the set of hrefs.

Returns:
an Enumeration of href Strings

insertHrefAfter

public void insertHrefAfter(String refHref,
                            String newHref)
Inserts the given newHref after the given refHref in the set of hrefs. If newHref already exists it is not inserted.

Parameters:
refHref - the existing href
newHref - the new href to be inserted after the existing href

insertHrefBefore

public void insertHrefBefore(String newHref,
                             String refHref)
Inserts the given newHref before the given refHref in the set of hrefs. If newHref already exists it is not inserted.

Parameters:
refHref - the existing href
newHref - the new href to be inserted before the existing href

isDuplicate

protected boolean isDuplicate(String encodedHref)

removeHref

public void removeHref(String href)
Remove the given href from the set of hrefs.

Parameters:
href - the href to remove from the set of hrefs


Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.