Metamodel classes
Overview
The classes
of the metamodel (as well as
basic classes and
work products) are the
only classes available from J. Their
definition can be extended by adding J methods or class attributes, but not by adding new instance attributes. New classes cannot be
created.
Access to a
model's information is deduced from the graphical representation of the
metamodel.
Note: The work
product class ("MpGenProduct") is an exception.
Accessing attributes
An object's
attributes are accessed through the
"." notation, by simply using their name:
Class c = ...;
String n;
n = c.Name;
or in the
context of a Class:
String n;
n = Name; // equivalent to : n = this.Name
Accessing associations
Access to
associations is achieved by concatenating the role name
with the association destination class name or one of its derived classes.

Figure 2.
Extract of the metamodel used
Class c= ...
Feature[] theFeature;
Attribute[] theAttributes;
// Access to the class c features :
// role == Part , destination class == Feature
theFeatures = c.PartFeature;
// Access to the class c attributes
// (the attributes are features)
// role == Part, destination class == Attribute
theAttributes = c.PartAttribute;
The type of object obtained also depends on the association's maximum multiplicity:
· If it is equal to 1, a simple object, which may be empty, is returned.
· If it is greater than 1, an object set, which may be empty, is returned.