Interface ModelElementInstance

    • Method Detail

      • getDomElement

        DomElement getDomElement()
        Returns the represented DOM DomElement.
        Returns:
        the DOM element
      • getModelInstance

        ModelInstance getModelInstance()
        Returns the model instance which contains this type instance.
        Returns:
        the model instance
      • getParentElement

        ModelElementInstance getParentElement()
        Returns the parent element of this.
        Returns:
        the parent element
      • getElementType

        ModelElementType getElementType()
        Returns the element type of this.
        Returns:
        the element type
      • getAttributeValue

        java.lang.String getAttributeValue​(java.lang.String attributeName)
        Returns the attribute value for the attribute name.
        Parameters:
        attributeName - the name of the attribute
        Returns:
        the value of the attribute
      • setAttributeValue

        void setAttributeValue​(java.lang.String attributeName,
                               java.lang.String xmlValue)
        Sets the value by name of a non-ID attribute.
        Parameters:
        attributeName - the name of the attribute
        xmlValue - the value to set
      • setAttributeValue

        void setAttributeValue​(java.lang.String attributeName,
                               java.lang.String xmlValue,
                               boolean isIdAttribute)
        Sets attribute value by name.
        Parameters:
        attributeName - the name of the attribute
        xmlValue - the value to set
        isIdAttribute - true if the attribute is an ID attribute, false otherwise
      • setAttributeValue

        void setAttributeValue​(java.lang.String attributeName,
                               java.lang.String xmlValue,
                               boolean isIdAttribute,
                               boolean withReferenceUpdate)
        Sets attribute value by name.
        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
      • removeAttribute

        void removeAttribute​(java.lang.String attributeName)
        Removes attribute by name.
        Parameters:
        attributeName - the name of the attribute
      • getAttributeValueNs

        java.lang.String getAttributeValueNs​(java.lang.String namespaceUri,
                                             java.lang.String attributeName)
        Returns the attribute value for the given attribute name and namespace URI.
        Parameters:
        namespaceUri - the namespace URI of the attribute
        attributeName - the attribute name of the attribute
        Returns:
        the value of the attribute
      • setAttributeValueNs

        void setAttributeValueNs​(java.lang.String namespaceUri,
                                 java.lang.String attributeName,
                                 java.lang.String xmlValue)
        Sets the value by name and namespace of a non-ID attribute.
        Parameters:
        namespaceUri - the namespace URI of the attribute
        attributeName - the name of the attribute
        xmlValue - the XML value to set
      • setAttributeValueNs

        void setAttributeValueNs​(java.lang.String namespaceUri,
                                 java.lang.String attributeName,
                                 java.lang.String xmlValue,
                                 boolean isIdAttribute)
        Sets the attribute value by name and namespace.
        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
      • setAttributeValueNs

        void setAttributeValueNs​(java.lang.String namespaceUri,
                                 java.lang.String attributeName,
                                 java.lang.String xmlValue,
                                 boolean isIdAttribute,
                                 boolean withReferenceUpdate)
        Sets the attribute value by name and namespace.
        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
      • removeAttributeNs

        void removeAttributeNs​(java.lang.String namespaceUri,
                               java.lang.String attributeName)
        Removes the attribute by name and namespace.
        Parameters:
        namespaceUri - the namespace URI of the attribute
        attributeName - the name of the attribute
      • getTextContent

        java.lang.String getTextContent()
        Returns the text content of the DOM element without leading and trailing spaces. For raw text content see ModelElementInstanceImpl.getRawTextContent().
        Returns:
        text content of underlying DOM element with leading and trailing whitespace trimmed
      • getRawTextContent

        java.lang.String getRawTextContent()
        Returns the raw text content of the DOM element including all whitespaces.
        Returns:
        raw text content of underlying DOM element
      • setTextContent

        void setTextContent​(java.lang.String textContent)
        Sets the text content of the DOM element
        Parameters:
        textContent - the new text content
      • replaceWithElement

        void replaceWithElement​(ModelElementInstance newElement)
        Replaces this element with a new element and updates references.
        Parameters:
        newElement - the new element to replace with
      • getUniqueChildElementByNameNs

        ModelElementInstance getUniqueChildElementByNameNs​(java.lang.String namespaceUri,
                                                           java.lang.String elementName)
        Returns a child element with the given name or 'null' if no such element exists
        Parameters:
        namespaceUri - the local name of the element
        elementName - the namespace of the element
        Returns:
        the child element or null.
      • getUniqueChildElementByType

        ModelElementInstance getUniqueChildElementByType​(java.lang.Class<? extends ModelElementInstance> elementType)
        Returns a child element with the given type
        Parameters:
        elementType - the type of the element
        Returns:
        the child element or null
      • setUniqueChildElementByNameNs

        void setUniqueChildElementByNameNs​(ModelElementInstance newChild)
        Adds 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.
        Parameters:
        newChild - the child to add
      • replaceChildElement

        void replaceChildElement​(ModelElementInstance existingChild,
                                 ModelElementInstance newChild)
        Replace an existing child element with a new child element. Changes the underlying DOM element tree.
        Parameters:
        existingChild - the child element to replace
        newChild - the new child element
      • addChildElement

        void addChildElement​(ModelElementInstance newChild)
        Adds 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.
        Parameters:
        newChild - the new child element
        Throws:
        ModelException - if the new child type is not an allowed child type
      • removeChildElement

        boolean removeChildElement​(ModelElementInstance child)
        Removes the child element from this.
        Parameters:
        child - the child element to remove
        Returns:
        true if the child element could be removed
      • getChildElementsByType

        java.util.Collection<ModelElementInstance> getChildElementsByType​(ModelElementType childElementType)
        Return all child elements of a given type
        Parameters:
        childElementType - the child element type to search for
        Returns:
        a collection of elements of the given type
      • getChildElementsByType

        <T extends ModelElementInstance> java.util.Collection<T> getChildElementsByType​(java.lang.Class<T> childElementClass)
        Return all child elements of a given type
        Parameters:
        childElementClass - the class of the child element type to search for
        Returns:
        a collection of elements to the given type
      • insertElementAfter

        void insertElementAfter​(ModelElementInstance elementToInsert,
                                ModelElementInstance insertAfterElement)
        Inserts the new element after the given element or at the beginning if the given element is null.
        Parameters:
        elementToInsert - the new element to insert
        insertAfterElement - the element to insert after or null to insert at first position
      • updateAfterReplacement

        void updateAfterReplacement()
        Execute updates after the element was inserted as a replacement of another element.