Method
create(_:)
Creates an instance of the specified class.
func create(_ eClass: EClass) -> DynamicEObject
Parameters
eClass-
The class to instantiate.
Return Value
A new instance of the specified class.
Discussion
This method creates a new object of the given class type. In this basic implementation, it returns a generic DynamicEObject that stores feature values dynamically.
In a complete EMF implementation, this would:
-
Use code generation to create specific typed classes
-
Or use dynamic proxies to create objects with proper behaviour
Example
if let employeeClass = package.getEClass("Employee") {
let employee = factory.create(employeeClass)
// In a complete implementation, would be able to:
// employee.eSet(nameAttribute, "Alice")
}