Java Reference
In-Depth Information
main ( in mmap : mindmap::Map@inModel, out req :
requirements::Model@outModel) {
req := mmap. map toRequirementsModel();
}
An example of using main without parameters follows. Strictly speaking,
this is what all main() operations should look like. In most cases, the in model
parameter is accessed directly and is used to invoke the mapping operation. The
rootObjects() operation is available on all Model objects. The use of brack-
ets in the statement is an example of the collectselect statement shorthand.
transformation mindmap2requirements( in inModel : mindmap,
out outModel : requirements);
main () {
inModel.rootObjects()[Map]-> map toRequirementsModel();
}
13.3.3 Inheritance, Merger, and Disjunction
Mappings can extend other mappings through inheritance, can have their result
merged with the result of another mapping, or can be executed based on the suc-
cess of their guard conditions. Each of these is discussed next, along with how
they impact the execution semantics at runtime.
inherits
Mapping operations can inherit from other mapping operations. During execu-
tion, the inherited mapping is invoked after the initialization section of the inher-
iting mapping. This includes the implicit instantiation section. The effect of this
is that output parameters are non- null when the inherited mapping is invoked.
Following is an example of inherits used in the context of our dnc2jee .
qvto transformation found in Section 6.9, “Transforming a Business Model to
Java.”
mapping dnc::Archetype::toClass() : java::JavaClass {
name := self .name;
fields += self .getAttributes(). map toField( result );
methods += self .getOperations(). map toMethod();
}
Search WWH ::




Custom Search