Starting from version 17.0, a UML model is implemented using Eclipse Modeling Framework (EMF), that is the UML model is an EMF model. All UML model classes implement the org.eclipse.emf.ecore.EObject interface. The UML model can be accessed and changed using the EMF API. For example:

    // get project model
    Package model = project.getPrimaryModel();
    // create session
    SessionManager.getInstance().createSession(project, "create class");


    // get name attribute
    EAttribute element_name = UMLPackage.eINSTANCE.getNamedElement_Name();
    // get name value (same as model.getName())
    Object name = model.eGet(element_name);
    System.out.println("name = " + name);
    // change name value (same as model.setName(name + "_1");)
    model.eSet(element_name, name + "_1");


    Class aClass = UMLFactory.eINSTANCE.createClass();


    // get packaged element collection
    Collection collection = (Collection)
    model.eGet(UMLPackage.eINSTANCE.getPackage_PackagedElement());
    // add new class (same result as model.getPackagedElement().add(aClass))
    collection.add(aClass);


    // close session
    SessionManager.getInstance().closeSession(project);