Documentation Language: Swift

Structure

EPackage

A package in the Ecore metamodel.

struct EPackage

Overview

EPackage is a container for classifiers (classes, data types, enums) and provides a namespace for metamodel elements. Packages are the top-level organisational unit in Ecore, similar to packages in Java or modules in Swift.

Each package has:

Example

let companyPackage = EPackage(
    name: "company",
    nsURI: "http://example.org/company",
    nsPrefix: "company",
    classifiers: [
        EClass(name: "Employee"),
        EClass(name: "Department")
    ]
)

// Look up a classifier
if let employee = companyPackage.getClassifier("Employee") as? EClass {
    print("Found class: \(employee.name)")
}

Namespace URIs

The namespace URI uniquely identifies the package across different systems and versions. By convention, it uses a reverse domain name format:

XML Namespace Prefixes

The namespace prefix is used in XMI serialisation to abbreviate element names:

<company:Employee xmlns:company="http://example.org/company" name="Alice"/>

Topics

Operators

?
==(_:_:)

Compares two packages for equality.

Initializers

?
init(object:shouldIgnoreUnresolvedClassifiers:)

Initialise an EPackage from a DynamicEObject (without resource context).

?
init(url:enableDebugging:)

Loads an EPackage from a .ecore file.

Instance Properties

V
eAnnotations

Annotations attached to this package.

V
eClass

The metaclass describing this package.

V
eClassifiers

The classifiers (types) defined in this package.

V
eFactoryInstance

The factory instance for creating objects of this package’s classes.

V
eSubpackages

Nested subpackages within this package.

V
id

Unique identifier for this package.

V
name

The name of this package.

V
nsPrefix

The namespace prefix for this package.

V
nsURI

The namespace URI for this package.

Instance Methods

F
eGet(_:)

Reflectively retrieves the value of a feature.

F
eIsSet(_:)

Checks whether a feature has been explicitly set.

F
eSet(_:_:)

Reflectively sets the value of a feature.

F
eUnset(_:)

Unsets a feature, returning it to its default value.

F
getClassifier(_:)

Retrieves a classifier by its name.

F
getEClass(_:)

Retrieves a class by its name.

F
getEDataType(_:)

Retrieves a data type by its name.

F
getEEnum(_:)

Retrieves an enumeration by its name.

F
getSubpackage(_:)

Retrieves a subpackage by its name.

F
hash(into:)

Hashes the essential components of this package.

Type Aliases

T
EPackage.Classifier

The type of classifier for this package.

Default Implementations

Relationships

Conforms To

See Also

Core Types

P
EObject

Base protocol for all Ecore model elements.

S
DynamicEObject

A dynamic implementation of EObject that stores feature values generically.

S
EClass

A class in the Ecore metamodel.