Model APIs

A model is an instance of the interface com.sodius.mdw.core.model.Model. A model contains model elements. Several methods are provided to retrieve these elements, and optionally to filter them, and to create new instances.

Most commonly used APIs
getInstances() Returns a list of all model elements attached to the model.
getInstances(String) Returns a list of all model elements of the specified type attached to the model. An optional boolean can be used to specify wheter you're interested in subtype instances.
create(String) Creates a new instance of a model element based on the specified type.


// Gets all Actors defined in this model
myActors = myModel.getInstances("Actor");

// Gets all Classifiers (Actors, UseCases, Classes, etc.) defined in this model
myClassifiers = myModel.getInstances("Classifier", true);

// Creates a new Actor instance and register it to the model
myNewActor = myModel.create("Actor");