JjOM API Reference
The JjOM API provides programmatic access to all elements in the Jjodel Object Model. You can use the API from the Console, within JjEL expressions, in viewpoint templates, and in event handlers.
DClass API
Section titled “DClass API”| Property | Type | Description |
|---|---|---|
name | String | Class name |
isAbstract | Boolean | Whether the class is abstract |
isInterface | Boolean | Whether the class is an interface |
isRootable | Boolean | Whether instances can be model roots |
isSingleton | Boolean | Whether only one instance is allowed |
isFinal | Boolean | Whether the class can be extended |
isPrimitive | Boolean | Whether this is a primitive type |
isMetamodel | Boolean | Whether this belongs to the metamodel level |
extends | Array<DClass> | Direct parent classes |
extendedBy | Array<DClass> | Direct subclasses |
attributes | Array<DAttribute> | Owned attributes |
references | Array<DReference> | Owned references |
operations | Array<DOperation> | Owned operations |
features | Array<Feature> | All structural features (attributes + references) |
instances | Array<DObject> | Direct instances of this class |
allInstances | Array<DObject> | All instances, including subclass instances |
packages | Array<DPackage> | Containing packages |
parent | * | Parent element in the containment hierarchy |
DObject API
Section titled “DObject API”| Property | Type | Description |
|---|---|---|
id | Pointer | Unique identifier |
className | String | Name of the instantiated class |
instanceOf | DClass | The metaclass |
parent | * | Containing element |
DAttribute API
Section titled “DAttribute API”| Property | Type | Description |
|---|---|---|
name | String | Attribute name |
type | String | Data type |
DReference API
Section titled “DReference API”| Property | Type | Description |
|---|---|---|
name | String | Reference name |
target | DClass | Target class |
containment | Boolean | Whether this is a containment reference |
DPackage API
Section titled “DPackage API”| Property | Type | Description |
|---|---|---|
name | String | Package name |
packages | Array<DPackage> | Nested packages |
objects | Array<DObject> | Contained elements |
Usage Examples
Section titled “Usage Examples”Querying instances
Section titled “Querying instances”// All instances of Person (including subclasses)Person.allInstances
// Filter by attribute valuePerson.allInstances.filter(p => p.name === "Alice")
// Count elementsClass.allInstances.lengthNavigating the model graph
Section titled “Navigating the model graph”// From instance to metaclassmyObject.instanceOf.name
// From class to its featuresPerson.attributes.map(a => a.name) // → ["name", "age"]
// From class to its subclassesEntity.extendedBy.map(c => c.name) // → ["Person", "Organization"]Checking properties
Section titled “Checking properties”// Is this class abstract?myClass.isAbstract // → true/false
// Can this class be used as a model root?myClass.isRootable // → true/false