Java Reference
In-Depth Information
transformation
dnc2jee(
in
modelIn : dnc,
out
modelOut : java);
import library Strings;
modeltype
dnc
uses
"http://www.eclipse.org/2008/dnc";
modeltype
oocore
uses
"http://www.eclipse.org/2008/oocore";
modeltype
ecore
uses
"http://www.eclipse.org/emf/2002/Ecore";
modeltype
java
uses
"java.xmi";
main
() {
modelIn.rootObjects()[Package]->
map
toPackage();
}
Cashier
Person
Phone
0..-1
«role»
«party»
«thing»
0..1
BigDecimal:calculateTotalSales()
firstName:String
lastName:String
type:String
countryCode:String
areaCode:String
number:String
0..1
Address
«place»
street:String
city:String
province:String
country:String
postalCode:String
Figure 6-20
Test color model
The
Strings
library is imported because we will need it shortly. Each of our
four domain models is declared in
modeltype
statements at the top of the file,
just above the main mapping that invokes a
toPackage()
mapping. The pack-
age names are mapped to each other, followed by a series of mappings that con-
vert specific archetypes to Entity or Stateful beans. Finally, subpackages are
processed recursively. The rest of the transformation definition includes com-
ments that should adequately describe how it works.
Search WWH ::
Custom Search