public class ModelElementInstanceImpl extends Object implements ModelElementInstance
| Modifier and Type | Field and Description |
|---|---|
protected ModelInstanceImpl |
modelInstance
the containing model instance
|
| Constructor and Description |
|---|
ModelElementInstanceImpl(ModelTypeInstanceContext instanceContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
addChildElement(ModelElementInstance newChild)
Adds a new child element to the children of this element.
|
protected <T> Set<T> |
asSet(T element,
Set<T> elements) |
boolean |
equals(Object obj) |
String |
getAttributeValue(String attributeName)
Returns the attribute value for the attribute name.
|
String |
getAttributeValueNs(String namespaceUri,
String attributeName)
Returns the attribute value for the given attribute name and namespace URI.
|
<T extends ModelElementInstance> |
getChildElementsByType(Class<T> childElementClass)
Return all child elements of a given type
|
Collection<ModelElementInstance> |
getChildElementsByType(ModelElementType childElementType)
Return all child elements of a given type
|
DomElement |
getDomElement()
Returns the represented DOM
DomElement. |
ModelElementType |
getElementType()
Returns the element type of this.
|
ModelInstanceImpl |
getModelInstance()
Returns the model instance which contains this type instance.
|
ModelElementInstance |
getParentElement()
Returns the parent element of this.
|
String |
getRawTextContent()
Returns the raw text content of the DOM element including all whitespaces.
|
String |
getTextContent()
Returns the text content of the DOM element without leading and trailing spaces.
|
ModelElementInstance |
getUniqueChildElementByNameNs(String namespaceUri,
String elementName)
Returns a child element with the given name or 'null' if no such element exists
|
ModelElementInstance |
getUniqueChildElementByType(Class<? extends ModelElementInstance> elementType)
Returns a child element with the given type
|
int |
hashCode() |
void |
insertElementAfter(ModelElementInstance elementToInsert,
ModelElementInstance insertAfterElement)
Inserts the new element after the given element or at the beginning if the given element is null.
|
static void |
registerType(ModelBuilder modelBuilder) |
void |
removeAttribute(String attributeName)
Removes attribute by name.
|
void |
removeAttributeNs(String namespaceUri,
String attributeName)
Removes the attribute by name and namespace.
|
boolean |
removeChildElement(ModelElementInstance child)
Removes the child element from this.
|
void |
replaceChildElement(ModelElementInstance existingChild,
ModelElementInstance newChild)
Replace an existing child element with a new child element.
|
void |
replaceWithElement(ModelElementInstance newElement)
Replaces this element with a new element and updates references.
|
void |
setAttributeValue(String attributeName,
String xmlValue)
Sets the value by name of a non-ID attribute.
|
void |
setAttributeValue(String attributeName,
String xmlValue,
boolean isIdAttribute)
Sets attribute value by name.
|
void |
setAttributeValue(String attributeName,
String xmlValue,
boolean isIdAttribute,
boolean withReferenceUpdate)
Sets attribute value by name.
|
void |
setAttributeValueNs(String namespaceUri,
String attributeName,
String xmlValue)
Sets the value by name and namespace of a non-ID attribute.
|
void |
setAttributeValueNs(String namespaceUri,
String attributeName,
String xmlValue,
boolean isIdAttribute)
Sets the attribute value by name and namespace.
|
void |
setAttributeValueNs(String namespaceUri,
String attributeName,
String xmlValue,
boolean isIdAttribute,
boolean withReferenceUpdate)
Sets the attribute value by name and namespace.
|
void |
setTextContent(String textContent)
Sets the text content of the DOM element
|
void |
setUniqueChildElementByNameNs(ModelElementInstance newChild)
Adds or replaces a child element by name.
|
void |
updateAfterReplacement()
Execute updates after the element was inserted as a replacement of another element.
|
protected final ModelInstanceImpl modelInstance
public ModelElementInstanceImpl(ModelTypeInstanceContext instanceContext)
public static void registerType(ModelBuilder modelBuilder)
public DomElement getDomElement()
ModelElementInstanceDomElement.getDomElement in interface ModelElementInstancepublic ModelInstanceImpl getModelInstance()
ModelElementInstancegetModelInstance in interface ModelElementInstancepublic ModelElementInstance getParentElement()
ModelElementInstancegetParentElement in interface ModelElementInstancepublic ModelElementType getElementType()
ModelElementInstancegetElementType in interface ModelElementInstancepublic String getAttributeValue(String attributeName)
ModelElementInstancegetAttributeValue in interface ModelElementInstanceattributeName - the name of the attributepublic String getAttributeValueNs(String namespaceUri, String attributeName)
ModelElementInstancegetAttributeValueNs in interface ModelElementInstancenamespaceUri - the namespace URI of the attributeattributeName - the attribute name of the attributepublic void setAttributeValue(String attributeName, String xmlValue)
ModelElementInstancesetAttributeValue in interface ModelElementInstanceattributeName - the name of the attributexmlValue - the value to setpublic void setAttributeValue(String attributeName, String xmlValue, boolean isIdAttribute)
ModelElementInstancesetAttributeValue in interface ModelElementInstanceattributeName - the name of the attributexmlValue - the value to setisIdAttribute - true if the attribute is an ID attribute, false otherwisepublic void setAttributeValue(String attributeName, String xmlValue, boolean isIdAttribute, boolean withReferenceUpdate)
ModelElementInstancesetAttributeValue in interface ModelElementInstanceattributeName - the name of the attributexmlValue - the value to setisIdAttribute - true if the attribute is an ID attribute, false otherwisewithReferenceUpdate - true to update incoming references in other elements, false otherwisepublic void setAttributeValueNs(String namespaceUri, String attributeName, String xmlValue)
ModelElementInstancesetAttributeValueNs in interface ModelElementInstancenamespaceUri - the namespace URI of the attributeattributeName - the name of the attributexmlValue - the XML value to setpublic void setAttributeValueNs(String namespaceUri, String attributeName, String xmlValue, boolean isIdAttribute)
ModelElementInstancesetAttributeValueNs in interface ModelElementInstancenamespaceUri - the namespace URI of the attributeattributeName - the name of the attributexmlValue - the XML value to setisIdAttribute - true if the attribute is an ID attribute, false otherwisepublic void setAttributeValueNs(String namespaceUri, String attributeName, String xmlValue, boolean isIdAttribute, boolean withReferenceUpdate)
ModelElementInstancesetAttributeValueNs in interface ModelElementInstancenamespaceUri - the namespace URI of the attributeattributeName - the name of the attributexmlValue - the XML value to setisIdAttribute - true if the attribute is an ID attribute, false otherwisewithReferenceUpdate - true to update incoming references in other elements, false otherwisepublic void removeAttribute(String attributeName)
ModelElementInstanceremoveAttribute in interface ModelElementInstanceattributeName - the name of the attributepublic void removeAttributeNs(String namespaceUri, String attributeName)
ModelElementInstanceremoveAttributeNs in interface ModelElementInstancenamespaceUri - the namespace URI of the attributeattributeName - the name of the attributepublic String getTextContent()
ModelElementInstancegetRawTextContent().getTextContent in interface ModelElementInstancepublic void setTextContent(String textContent)
ModelElementInstancesetTextContent in interface ModelElementInstancetextContent - the new text contentpublic String getRawTextContent()
ModelElementInstancegetRawTextContent in interface ModelElementInstancepublic ModelElementInstance getUniqueChildElementByNameNs(String namespaceUri, String elementName)
ModelElementInstancegetUniqueChildElementByNameNs in interface ModelElementInstancenamespaceUri - the local name of the elementelementName - the namespace of the elementpublic ModelElementInstance getUniqueChildElementByType(Class<? extends ModelElementInstance> elementType)
ModelElementInstancegetUniqueChildElementByType in interface ModelElementInstanceelementType - the type of the elementpublic void setUniqueChildElementByNameNs(ModelElementInstance newChild)
ModelElementInstancesetUniqueChildElementByNameNs in interface ModelElementInstancenewChild - the child to addpublic void replaceChildElement(ModelElementInstance existingChild, ModelElementInstance newChild)
ModelElementInstancereplaceChildElement in interface ModelElementInstanceexistingChild - the child element to replacenewChild - the new child elementpublic void replaceWithElement(ModelElementInstance newElement)
ModelElementInstancereplaceWithElement in interface ModelElementInstancenewElement - the new element to replace withpublic void addChildElement(ModelElementInstance newChild)
ModelElementInstanceaddChildElement in interface ModelElementInstancenewChild - the new child elementpublic boolean removeChildElement(ModelElementInstance child)
ModelElementInstanceremoveChildElement in interface ModelElementInstancechild - the child element to removepublic Collection<ModelElementInstance> getChildElementsByType(ModelElementType childElementType)
ModelElementInstancegetChildElementsByType in interface ModelElementInstancechildElementType - the child element type to search forpublic <T extends ModelElementInstance> Collection<T> getChildElementsByType(Class<T> childElementClass)
ModelElementInstancegetChildElementsByType in interface ModelElementInstancechildElementClass - the class of the child element type to search forpublic void insertElementAfter(ModelElementInstance elementToInsert, ModelElementInstance insertAfterElement)
ModelElementInstanceinsertElementAfter in interface ModelElementInstanceelementToInsert - the new element to insertinsertAfterElement - the element to insert after or null to insert at first positionpublic void updateAfterReplacement()
ModelElementInstanceupdateAfterReplacement in interface ModelElementInstanceCopyright © 2021. All rights reserved.