Class DomElementImpl
- java.lang.Object
-
- org.camunda.bpm.model.xml.impl.instance.DomElementImpl
-
- All Implemented Interfaces:
DomElement
public class DomElementImpl extends Object implements DomElement
- Author:
- Sebastian Menski
-
-
Constructor Summary
Constructors Constructor Description DomElementImpl(Element element)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCDataSection(String data)Adds a CDATA section to this element.voidappendChild(DomElement childDomElement)Appends the element to the child elements of this element.booleanequals(Object o)StringgetAttribute(String attributeName)Returns the attribute value for the namespace of this element.StringgetAttribute(String namespaceUri, String localName)Returns the attribute value for the given namespace.List<DomElement>getChildElements()Returns all child elements of this element.List<DomElement>getChildElementsByNameNs(String namespaceUri, String elementName)Returns all child elements of this element with a specific namespace + nameList<DomElement>getChildElementsByNameNs(Set<String> namespaceUris, String elementName)Returns all child elements of this element with specific namespaces + name.List<DomElement>getChildElementsByType(ModelInstanceImpl modelInstance, Class<? extends ModelElementInstance> elementType)Returns all child elements of this element with a specific type.DomDocumentgetDocument()Returns the DOM document which contains this element.protected ElementgetElement()StringgetLocalName()Returns the local name of this element.ModelElementInstancegetModelElementInstance()Returns theModelElementInstancewhich is associated with this element.StringgetNamespaceURI()Returns the namespace URI for this element.DomElementgetParentElement()Returns the parent element of this element.StringgetPrefix()Returns the prefix of this element.DomElementgetRootElement()Returns the root element of the document which contains this element.StringgetTextContent()Gets the text content of this element all its descendants.booleanhasAttribute(String localName)Checks if this element has a attribute under the namespace of this element.booleanhasAttribute(String namespaceUri, String localName)Checks if this element has a attribute with the given namespace.inthashCode()voidinsertChildElementAfter(DomElement elementToInsert, DomElement insertAfter)Inserts the new child element after another child element.StringlookupPrefix(String namespaceUri)Returns the prefix of the namespace starting from this node upwards.StringregisterNamespace(String namespaceUri)Adds a new namespace with a generated prefix to this element.voidregisterNamespace(String prefix, String namespaceUri)Adds a new namespace with prefix to this element.voidremoveAttribute(String localName)Removes the attribute for the namespace of this element.voidremoveAttribute(String namespaceUri, String localName)Removes the attribute for the given namespace.booleanremoveChild(DomElement childDomElement)Removes a child element of this element.voidreplaceChild(DomElement newChildDomElement, DomElement existingChildDomElement)Replaces a child element with a new element.voidsetAttribute(String localName, String value)Sets the attribute value for the namespace of this element.voidsetAttribute(String namespaceUri, String localName, String value)Sets the attribute value for the given namespace.voidsetIdAttribute(String localName, String value)Sets the value of a id attribute for the namespace of this element.voidsetIdAttribute(String namespaceUri, String localName, String value)Sets the value of a id attribute for the given namespace.voidsetModelElementInstance(ModelElementInstance modelElementInstance)Sets theModelElementInstancewhich should be associated with this element.voidsetTextContent(String textContent)Sets the text content of this element.
-
-
-
Constructor Detail
-
DomElementImpl
public DomElementImpl(Element element)
-
-
Method Detail
-
getElement
protected Element getElement()
-
getNamespaceURI
public String getNamespaceURI()
Description copied from interface:DomElementReturns the namespace URI for this element.- Specified by:
getNamespaceURIin interfaceDomElement- Returns:
- the namespace URI
-
getLocalName
public String getLocalName()
Description copied from interface:DomElementReturns the local name of this element.- Specified by:
getLocalNamein interfaceDomElement- Returns:
- the local name
-
getPrefix
public String getPrefix()
Description copied from interface:DomElementReturns the prefix of this element.- Specified by:
getPrefixin interfaceDomElement- Returns:
- the prefix
-
getDocument
public DomDocument getDocument()
Description copied from interface:DomElementReturns the DOM document which contains this element.- Specified by:
getDocumentin interfaceDomElement- Returns:
- the DOM document or null if the element itself is a document
-
getRootElement
public DomElement getRootElement()
Description copied from interface:DomElementReturns the root element of the document which contains this element.- Specified by:
getRootElementin interfaceDomElement- Returns:
- the root element of the document or null if non exists
-
getParentElement
public DomElement getParentElement()
Description copied from interface:DomElementReturns the parent element of this element.- Specified by:
getParentElementin interfaceDomElement- Returns:
- the parent element or null if not part of a tree
-
getChildElements
public List<DomElement> getChildElements()
Description copied from interface:DomElementReturns all child elements of this element.- Specified by:
getChildElementsin interfaceDomElement- Returns:
- the list of child elements
-
getChildElementsByNameNs
public List<DomElement> getChildElementsByNameNs(String namespaceUri, String elementName)
Description copied from interface:DomElementReturns all child elements of this element with a specific namespace + name- Specified by:
getChildElementsByNameNsin interfaceDomElement- Returns:
- the list of child elements
-
getChildElementsByNameNs
public List<DomElement> getChildElementsByNameNs(Set<String> namespaceUris, String elementName)
Description copied from interface:DomElementReturns all child elements of this element with specific namespaces + name.- Specified by:
getChildElementsByNameNsin interfaceDomElement- Returns:
- the list of child elements
-
getChildElementsByType
public List<DomElement> getChildElementsByType(ModelInstanceImpl modelInstance, Class<? extends ModelElementInstance> elementType)
Description copied from interface:DomElementReturns all child elements of this element with a specific type.- Specified by:
getChildElementsByTypein interfaceDomElement- Returns:
- the list of child elements matching the type
-
replaceChild
public void replaceChild(DomElement newChildDomElement, DomElement existingChildDomElement)
Description copied from interface:DomElementReplaces a child element with a new element.- Specified by:
replaceChildin interfaceDomElement- Parameters:
newChildDomElement- the new child elementexistingChildDomElement- the existing child element
-
removeChild
public boolean removeChild(DomElement childDomElement)
Description copied from interface:DomElementRemoves a child element of this element.- Specified by:
removeChildin interfaceDomElement- Parameters:
childDomElement- the child element to remove- Returns:
- true if the child element was removed otherwise false
-
appendChild
public void appendChild(DomElement childDomElement)
Description copied from interface:DomElementAppends the element to the child elements of this element.- Specified by:
appendChildin interfaceDomElement- Parameters:
childDomElement- the element to append
-
insertChildElementAfter
public void insertChildElementAfter(DomElement elementToInsert, DomElement insertAfter)
Description copied from interface:DomElementInserts the new child element after another child element. If the child element to insert after is null the new child element will be inserted at the beginning.- Specified by:
insertChildElementAfterin interfaceDomElement- Parameters:
elementToInsert- the new element to insertinsertAfter- the existing child element to insert after or null
-
hasAttribute
public boolean hasAttribute(String localName)
Description copied from interface:DomElementChecks if this element has a attribute under the namespace of this element.- Specified by:
hasAttributein interfaceDomElement- Parameters:
localName- the name of the attribute- Returns:
- true if the attribute exists otherwise false
-
hasAttribute
public boolean hasAttribute(String namespaceUri, String localName)
Description copied from interface:DomElementChecks if this element has a attribute with the given namespace.- Specified by:
hasAttributein interfaceDomElement- Parameters:
namespaceUri- the namespaceUri of the namespacelocalName- the name of the attribute- Returns:
- true if the attribute exists otherwise false
-
getAttribute
public String getAttribute(String attributeName)
Description copied from interface:DomElementReturns the attribute value for the namespace of this element.- Specified by:
getAttributein interfaceDomElement- Parameters:
attributeName- the name of the attribute- Returns:
- the value of the attribute or the empty string
-
getAttribute
public String getAttribute(String namespaceUri, String localName)
Description copied from interface:DomElementReturns the attribute value for the given namespace.- Specified by:
getAttributein interfaceDomElement- Parameters:
namespaceUri- the namespaceUri of the namespacelocalName- the name of the attribute- Returns:
- the value of the attribute or the empty string
-
setAttribute
public void setAttribute(String localName, String value)
Description copied from interface:DomElementSets the attribute value for the namespace of this element.- Specified by:
setAttributein interfaceDomElement- Parameters:
localName- the name of the attributevalue- the value to set
-
setAttribute
public void setAttribute(String namespaceUri, String localName, String value)
Description copied from interface:DomElementSets the attribute value for the given namespace.- Specified by:
setAttributein interfaceDomElement- Parameters:
namespaceUri- the namespaceUri of the namespacelocalName- the name of the attributevalue- the value to set
-
setIdAttribute
public void setIdAttribute(String localName, String value)
Description copied from interface:DomElementSets the value of a id attribute for the namespace of this element.- Specified by:
setIdAttributein interfaceDomElement- Parameters:
localName- the name of the attributevalue- the value to set
-
setIdAttribute
public void setIdAttribute(String namespaceUri, String localName, String value)
Description copied from interface:DomElementSets the value of a id attribute for the given namespace.- Specified by:
setIdAttributein interfaceDomElement- Parameters:
namespaceUri- the namespaceUri of the namespacelocalName- the name of the attributevalue- the value to set
-
removeAttribute
public void removeAttribute(String localName)
Description copied from interface:DomElementRemoves the attribute for the namespace of this element.- Specified by:
removeAttributein interfaceDomElement- Parameters:
localName- the name of the attribute
-
removeAttribute
public void removeAttribute(String namespaceUri, String localName)
Description copied from interface:DomElementRemoves the attribute for the given namespace.- Specified by:
removeAttributein interfaceDomElement- Parameters:
namespaceUri- the namespaceUri of the namespacelocalName- the name of the attribute
-
getTextContent
public String getTextContent()
Description copied from interface:DomElementGets the text content of this element all its descendants.- Specified by:
getTextContentin interfaceDomElement- Returns:
- the text content
-
setTextContent
public void setTextContent(String textContent)
Description copied from interface:DomElementSets the text content of this element.- Specified by:
setTextContentin interfaceDomElement- Parameters:
textContent- the text content to set
-
addCDataSection
public void addCDataSection(String data)
Description copied from interface:DomElementAdds a CDATA section to this element.- Specified by:
addCDataSectionin interfaceDomElement
-
getModelElementInstance
public ModelElementInstance getModelElementInstance()
Description copied from interface:DomElementReturns theModelElementInstancewhich is associated with this element.- Specified by:
getModelElementInstancein interfaceDomElement- Returns:
- the
ModelElementInstanceor null if non is associated
-
setModelElementInstance
public void setModelElementInstance(ModelElementInstance modelElementInstance)
Description copied from interface:DomElementSets theModelElementInstancewhich should be associated with this element.- Specified by:
setModelElementInstancein interfaceDomElement- Parameters:
modelElementInstance- theModelElementInstanceto associate
-
registerNamespace
public String registerNamespace(String namespaceUri)
Description copied from interface:DomElementAdds a new namespace with a generated prefix to this element.- Specified by:
registerNamespacein interfaceDomElement- Parameters:
namespaceUri- the namespaceUri of the namespace- Returns:
- the generated prefix for the new namespace
-
registerNamespace
public void registerNamespace(String prefix, String namespaceUri)
Description copied from interface:DomElementAdds a new namespace with prefix to this element.- Specified by:
registerNamespacein interfaceDomElement- Parameters:
prefix- the prefix of the namespacenamespaceUri- the namespaceUri of the namespace
-
lookupPrefix
public String lookupPrefix(String namespaceUri)
Description copied from interface:DomElementReturns the prefix of the namespace starting from this node upwards. The default namespace has the prefixnull.- Specified by:
lookupPrefixin interfaceDomElement- Parameters:
namespaceUri- the namespaceUri of the namespace- Returns:
- the prefix or null if non is defined
-
-