Class ModelElementInstanceImpl
- java.lang.Object
- 
- org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl
 
- 
- All Implemented Interfaces:
- ModelElementInstance
 - Direct Known Subclasses:
- BpmnModelElementInstanceImpl,- CmmnModelElementInstanceImpl,- DmnModelElementInstanceImpl
 
 public class ModelElementInstanceImpl extends java.lang.Object implements ModelElementInstance Base class for implementing Model Elements.- Author:
- Daniel Meyer
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected ModelInstanceImplmodelInstancethe containing model instance
 - 
Constructor SummaryConstructors Constructor Description ModelElementInstanceImpl(ModelTypeInstanceContext instanceContext)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChildElement(ModelElementInstance newChild)Adds a new child element to the children of this element.protected <T> java.util.Set<T>asSet(T element, java.util.Set<T> elements)booleanequals(java.lang.Object obj)java.lang.StringgetAttributeValue(java.lang.String attributeName)Returns the attribute value for the attribute name.java.lang.StringgetAttributeValueNs(java.lang.String namespaceUri, java.lang.String attributeName)Returns the attribute value for the given attribute name and namespace URI.<T extends ModelElementInstance>
 java.util.Collection<T>getChildElementsByType(java.lang.Class<T> childElementClass)Return all child elements of a given typejava.util.Collection<ModelElementInstance>getChildElementsByType(ModelElementType childElementType)Return all child elements of a given typeDomElementgetDomElement()Returns the represented DOMDomElement.ModelElementTypegetElementType()Returns the element type of this.ModelInstanceImplgetModelInstance()Returns the model instance which contains this type instance.ModelElementInstancegetParentElement()Returns the parent element of this.java.lang.StringgetRawTextContent()Returns the raw text content of the DOM element including all whitespaces.java.lang.StringgetTextContent()Returns the text content of the DOM element without leading and trailing spaces.ModelElementInstancegetUniqueChildElementByNameNs(java.lang.String namespaceUri, java.lang.String elementName)Returns a child element with the given name or 'null' if no such element existsModelElementInstancegetUniqueChildElementByType(java.lang.Class<? extends ModelElementInstance> elementType)Returns a child element with the given typeinthashCode()voidinsertElementAfter(ModelElementInstance elementToInsert, ModelElementInstance insertAfterElement)Inserts the new element after the given element or at the beginning if the given element is null.static voidregisterType(ModelBuilder modelBuilder)voidremoveAttribute(java.lang.String attributeName)Removes attribute by name.voidremoveAttributeNs(java.lang.String namespaceUri, java.lang.String attributeName)Removes the attribute by name and namespace.booleanremoveChildElement(ModelElementInstance child)Removes the child element from this.voidreplaceChildElement(ModelElementInstance existingChild, ModelElementInstance newChild)Replace an existing child element with a new child element.voidreplaceWithElement(ModelElementInstance newElement)Replaces this element with a new element and updates references.voidsetAttributeValue(java.lang.String attributeName, java.lang.String xmlValue)Sets the value by name of a non-ID attribute.voidsetAttributeValue(java.lang.String attributeName, java.lang.String xmlValue, boolean isIdAttribute)Sets attribute value by name.voidsetAttributeValue(java.lang.String attributeName, java.lang.String xmlValue, boolean isIdAttribute, boolean withReferenceUpdate)Sets attribute value by name.voidsetAttributeValueNs(java.lang.String namespaceUri, java.lang.String attributeName, java.lang.String xmlValue)Sets the value by name and namespace of a non-ID attribute.voidsetAttributeValueNs(java.lang.String namespaceUri, java.lang.String attributeName, java.lang.String xmlValue, boolean isIdAttribute)Sets the attribute value by name and namespace.voidsetAttributeValueNs(java.lang.String namespaceUri, java.lang.String attributeName, java.lang.String xmlValue, boolean isIdAttribute, boolean withReferenceUpdate)Sets the attribute value by name and namespace.voidsetTextContent(java.lang.String textContent)Sets the text content of the DOM elementvoidsetUniqueChildElementByNameNs(ModelElementInstance newChild)Adds or replaces a child element by name.voidupdateAfterReplacement()Execute updates after the element was inserted as a replacement of another element.
 
- 
- 
- 
Field Detail- 
modelInstanceprotected final ModelInstanceImpl modelInstance the containing model instance
 
- 
 - 
Constructor Detail- 
ModelElementInstanceImplpublic ModelElementInstanceImpl(ModelTypeInstanceContext instanceContext) 
 
- 
 - 
Method Detail- 
registerTypepublic static void registerType(ModelBuilder modelBuilder) 
 - 
getDomElementpublic DomElement getDomElement() Description copied from interface:ModelElementInstanceReturns the represented DOMDomElement.- Specified by:
- getDomElementin interface- ModelElementInstance
- Returns:
- the DOM element
 
 - 
getModelInstancepublic ModelInstanceImpl getModelInstance() Description copied from interface:ModelElementInstanceReturns the model instance which contains this type instance.- Specified by:
- getModelInstancein interface- ModelElementInstance
- Returns:
- the model instance
 
 - 
getParentElementpublic ModelElementInstance getParentElement() Description copied from interface:ModelElementInstanceReturns the parent element of this.- Specified by:
- getParentElementin interface- ModelElementInstance
- Returns:
- the parent element
 
 - 
getElementTypepublic ModelElementType getElementType() Description copied from interface:ModelElementInstanceReturns the element type of this.- Specified by:
- getElementTypein interface- ModelElementInstance
- Returns:
- the element type
 
 - 
getAttributeValuepublic java.lang.String getAttributeValue(java.lang.String attributeName) Description copied from interface:ModelElementInstanceReturns the attribute value for the attribute name.- Specified by:
- getAttributeValuein interface- ModelElementInstance
- Parameters:
- attributeName- the name of the attribute
- Returns:
- the value of the attribute
 
 - 
getAttributeValueNspublic java.lang.String getAttributeValueNs(java.lang.String namespaceUri, java.lang.String attributeName)Description copied from interface:ModelElementInstanceReturns the attribute value for the given attribute name and namespace URI.- Specified by:
- getAttributeValueNsin interface- ModelElementInstance
- Parameters:
- namespaceUri- the namespace URI of the attribute
- attributeName- the attribute name of the attribute
- Returns:
- the value of the attribute
 
 - 
setAttributeValuepublic void setAttributeValue(java.lang.String attributeName, java.lang.String xmlValue)Description copied from interface:ModelElementInstanceSets the value by name of a non-ID attribute.- Specified by:
- setAttributeValuein interface- ModelElementInstance
- Parameters:
- attributeName- the name of the attribute
- xmlValue- the value to set
 
 - 
setAttributeValuepublic void setAttributeValue(java.lang.String attributeName, java.lang.String xmlValue, boolean isIdAttribute)Description copied from interface:ModelElementInstanceSets attribute value by name.- Specified by:
- setAttributeValuein interface- ModelElementInstance
- Parameters:
- attributeName- the name of the attribute
- xmlValue- the value to set
- isIdAttribute- true if the attribute is an ID attribute, false otherwise
 
 - 
setAttributeValuepublic void setAttributeValue(java.lang.String attributeName, java.lang.String xmlValue, boolean isIdAttribute, boolean withReferenceUpdate)Description copied from interface:ModelElementInstanceSets attribute value by name.- Specified by:
- setAttributeValuein interface- ModelElementInstance
- Parameters:
- attributeName- the name of the attribute
- xmlValue- the value to set
- isIdAttribute- true if the attribute is an ID attribute, false otherwise
- withReferenceUpdate- true to update incoming references in other elements, false otherwise
 
 - 
setAttributeValueNspublic void setAttributeValueNs(java.lang.String namespaceUri, java.lang.String attributeName, java.lang.String xmlValue)Description copied from interface:ModelElementInstanceSets the value by name and namespace of a non-ID attribute.- Specified by:
- setAttributeValueNsin interface- ModelElementInstance
- Parameters:
- namespaceUri- the namespace URI of the attribute
- attributeName- the name of the attribute
- xmlValue- the XML value to set
 
 - 
setAttributeValueNspublic void setAttributeValueNs(java.lang.String namespaceUri, java.lang.String attributeName, java.lang.String xmlValue, boolean isIdAttribute)Description copied from interface:ModelElementInstanceSets the attribute value by name and namespace.- Specified by:
- setAttributeValueNsin interface- ModelElementInstance
- Parameters:
- namespaceUri- the namespace URI of the attribute
- attributeName- the name of the attribute
- xmlValue- the XML value to set
- isIdAttribute- true if the attribute is an ID attribute, false otherwise
 
 - 
setAttributeValueNspublic void setAttributeValueNs(java.lang.String namespaceUri, java.lang.String attributeName, java.lang.String xmlValue, boolean isIdAttribute, boolean withReferenceUpdate)Description copied from interface:ModelElementInstanceSets the attribute value by name and namespace.- Specified by:
- setAttributeValueNsin interface- ModelElementInstance
- Parameters:
- namespaceUri- the namespace URI of the attribute
- attributeName- the name of the attribute
- xmlValue- the XML value to set
- isIdAttribute- true if the attribute is an ID attribute, false otherwise
- withReferenceUpdate- true to update incoming references in other elements, false otherwise
 
 - 
removeAttributepublic void removeAttribute(java.lang.String attributeName) Description copied from interface:ModelElementInstanceRemoves attribute by name.- Specified by:
- removeAttributein interface- ModelElementInstance
- Parameters:
- attributeName- the name of the attribute
 
 - 
removeAttributeNspublic void removeAttributeNs(java.lang.String namespaceUri, java.lang.String attributeName)Description copied from interface:ModelElementInstanceRemoves the attribute by name and namespace.- Specified by:
- removeAttributeNsin interface- ModelElementInstance
- Parameters:
- namespaceUri- the namespace URI of the attribute
- attributeName- the name of the attribute
 
 - 
getTextContentpublic java.lang.String getTextContent() Description copied from interface:ModelElementInstanceReturns the text content of the DOM element without leading and trailing spaces. For raw text content seegetRawTextContent().- Specified by:
- getTextContentin interface- ModelElementInstance
- Returns:
- text content of underlying DOM element with leading and trailing whitespace trimmed
 
 - 
setTextContentpublic void setTextContent(java.lang.String textContent) Description copied from interface:ModelElementInstanceSets the text content of the DOM element- Specified by:
- setTextContentin interface- ModelElementInstance
- Parameters:
- textContent- the new text content
 
 - 
getRawTextContentpublic java.lang.String getRawTextContent() Description copied from interface:ModelElementInstanceReturns the raw text content of the DOM element including all whitespaces.- Specified by:
- getRawTextContentin interface- ModelElementInstance
- Returns:
- raw text content of underlying DOM element
 
 - 
getUniqueChildElementByNameNspublic ModelElementInstance getUniqueChildElementByNameNs(java.lang.String namespaceUri, java.lang.String elementName) Description copied from interface:ModelElementInstanceReturns a child element with the given name or 'null' if no such element exists- Specified by:
- getUniqueChildElementByNameNsin interface- ModelElementInstance
- Parameters:
- namespaceUri- the local name of the element
- elementName- the namespace of the element
- Returns:
- the child element or null.
 
 - 
getUniqueChildElementByTypepublic ModelElementInstance getUniqueChildElementByType(java.lang.Class<? extends ModelElementInstance> elementType) Description copied from interface:ModelElementInstanceReturns a child element with the given type- Specified by:
- getUniqueChildElementByTypein interface- ModelElementInstance
- Parameters:
- elementType- the type of the element
- Returns:
- the child element or null
 
 - 
setUniqueChildElementByNameNspublic void setUniqueChildElementByNameNs(ModelElementInstance newChild) Description copied from interface:ModelElementInstanceAdds or replaces a child element by name. Replaces an existing Child Element with the same name or adds a new child if no such element exists.- Specified by:
- setUniqueChildElementByNameNsin interface- ModelElementInstance
- Parameters:
- newChild- the child to add
 
 - 
replaceChildElementpublic void replaceChildElement(ModelElementInstance existingChild, ModelElementInstance newChild) Description copied from interface:ModelElementInstanceReplace an existing child element with a new child element. Changes the underlying DOM element tree.- Specified by:
- replaceChildElementin interface- ModelElementInstance
- Parameters:
- existingChild- the child element to replace
- newChild- the new child element
 
 - 
replaceWithElementpublic void replaceWithElement(ModelElementInstance newElement) Description copied from interface:ModelElementInstanceReplaces this element with a new element and updates references.- Specified by:
- replaceWithElementin interface- ModelElementInstance
- Parameters:
- newElement- the new element to replace with
 
 - 
addChildElementpublic void addChildElement(ModelElementInstance newChild) Description copied from interface:ModelElementInstanceAdds a new child element to the children of this element. The child is inserted at the correct position of the allowed child types. Updates the underlying DOM element tree.- Specified by:
- addChildElementin interface- ModelElementInstance
- Parameters:
- newChild- the new child element
 
 - 
removeChildElementpublic boolean removeChildElement(ModelElementInstance child) Description copied from interface:ModelElementInstanceRemoves the child element from this.- Specified by:
- removeChildElementin interface- ModelElementInstance
- Parameters:
- child- the child element to remove
- Returns:
- true if the child element could be removed
 
 - 
getChildElementsByTypepublic java.util.Collection<ModelElementInstance> getChildElementsByType(ModelElementType childElementType) Description copied from interface:ModelElementInstanceReturn all child elements of a given type- Specified by:
- getChildElementsByTypein interface- ModelElementInstance
- Parameters:
- childElementType- the child element type to search for
- Returns:
- a collection of elements of the given type
 
 - 
getChildElementsByTypepublic <T extends ModelElementInstance> java.util.Collection<T> getChildElementsByType(java.lang.Class<T> childElementClass) Description copied from interface:ModelElementInstanceReturn all child elements of a given type- Specified by:
- getChildElementsByTypein interface- ModelElementInstance
- Parameters:
- childElementClass- the class of the child element type to search for
- Returns:
- a collection of elements to the given type
 
 - 
insertElementAfterpublic void insertElementAfter(ModelElementInstance elementToInsert, ModelElementInstance insertAfterElement) Description copied from interface:ModelElementInstanceInserts the new element after the given element or at the beginning if the given element is null.- Specified by:
- insertElementAfterin interface- ModelElementInstance
- Parameters:
- elementToInsert- the new element to insert
- insertAfterElement- the element to insert after or null to insert at first position
 
 - 
updateAfterReplacementpublic void updateAfterReplacement() Description copied from interface:ModelElementInstanceExecute updates after the element was inserted as a replacement of another element.- Specified by:
- updateAfterReplacementin interface- ModelElementInstance
 
 - 
asSetprotected <T> java.util.Set<T> asSet(T element, java.util.Set<T> elements)
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
equalspublic boolean equals(java.lang.Object obj) - Overrides:
- equalsin class- java.lang.Object
 
 
- 
 
-