Java Reference
In-Depth Information
Figure 11-11
EClassifier model
11.3.4 Feature Initialization
Certain attributes of the underlying domain element might need to be initialized
to some value when a node is added to a diagram. To accomplish this, we can
use a Feature Seq Initializer child element on the Node Mapping . The
feature initialization is shown in Figure 11-12. It's also possible to initialize new
reference elements and their attributes, as shown in the initialization of the
Requirement element and its Version in Section 4.4.3, “Mapping Definition.”
Another common application of initialization is in naming elements placed on a
diagram, such as archetypes on our color modeling diagram of Section 4.6,
“Developing the Color Modeling Diagram.” If we added an OCL statement to
the initializer such as the following, each new archetype would be created with
the name ClassX, where X is the number of elements in the package: "Class"
+ container.childElements->size() .
As mentioned earlier, feature initialization is commonly used in conjunction
with a node Constraint element. The constraint specifies the state of an object
to distinguish it from other instances, and it is required for the generator to pro-
duce a diagram that works when several nodes are mapped to the same diagram
element.
Search WWH ::




Custom Search