Documentation Language: Swift

Protocol

EModelElement

Base protocol for model elements that can have annotations.

protocol EModelElement : EObject

Overview

EModelElement extends EObject to add support for attaching annotations, making it the base for most metamodel elements including classes, attributes, references, packages, and more.

Annotations allow metadata to be attached to model elements without modifying the core metamodel structure, supporting use cases such as:

Usage

struct MyClass: EModelElement {
    let id: EUUID
    let eClass: MyClassifier
    var eAnnotations: [EAnnotation] = []

    mutating func addDocumentation(_ text: String) {
        let annotation = EAnnotation(
            source: "http://www.eclipse.org/emf/2002/GenModel",
            details: ["documentation": text]
        )
        eAnnotations.append(annotation)
    }
}

Topics

Instance Properties

V
eAnnotations

Annotations attached to this model element.

Instance Methods

F
getEAnnotation(source:)

Retrieves an annotation by its source URI.

Relationships

Inherits From

Inherited By

Conforming Types

See Also

Supporting Types

S
EFactory

A factory for creating instances of model elements.

P
ENamedElement

Base protocol for model elements that have a name.