Hi,
I'd like to use anonymous bound template classes to specify attributes and operation parameters and can't figure out how (if?) you can do it with EA.
See UML Superstructure Specification, v2.4.1,
http://www.omg.org/spec/UML/2.4.1/Superstructure/PDF page 642.
Example:
Assume I have a class named "Pair" with template parameters "A" and "B" and the (parameterless) classes named "Point", "Circle" and "Rectangle" in my platform independent model (PIM). Then it should be possible (according to the above mentioned part of the UML specification) to specify attributes and methods using anonymous bound classes like this:
+ exampleAttribute: Pair<A -> Point, B -> Rectangle>
+ anotherAttribute: Pair<A -> Circle, B -> Point>
+ exampleOperation(param: Pair<A -> Rectangle, B -> Rectangle>): void
This uses the three anonymous bound classes "Pair<A -> Point, B -> Rectangle>", "Pair<A -> Circle, B -> Point>" and "Pair<A -> Rectangle, B -> Rectangle>".
In EA I found three ways to perform template bindings:
a) generalizations with template bindings
b) directed dependencies with template bindings
c) <<bind>> stereotyped dependencies
a) works, but you have to define three new classes, e.g. "Pair_Point_Rectangle" that specializes "Pair" and binds the parameters "A" and "B" using the "Binding" property page of the generalization. The two other classes need to be defined in a similar way. Then these three new classes can be used to specify attributes and operation parameters. But this is not only hard to read but it leads to redundancy when you create a PSM by transforming the PIM. It also results in redundant code, as the three new classes are not needed (e.g. in Java).
b) works for attributes (not operation parameters) in a limited way, but when performing model transformations from a platform independend model (PIM) that uses directed dependencies with template bindings to a Java platform specific model (PSM) all information about the bindings is lost. The transformation generates a Java class that contains
+ exampleAttribute: Pair
+ anotherExample: Pair
without any template information. And this method isn't usable for operation parameters.
c) can be used to specify the bindings, but I don't know how to use them later on. They appear in the "Bindings" section of the "Templates" property page of the class, but I can't create any attributes or operations using them.
So how can I bind template classes without having to specify new explicit classes?
Thanks to anyone who read the whole thing without throwing exception TL;DR :-)
Michael