I just tried using Green UML and the first thing I tried to do was create a composition from a class to an interface. Green tried to make me pick a concrete type. I'm not sure where that's coming from but this tool is useless to me if I can't define a composition of objects of an interface type. That's probably the most common kind of thing people should be doing in a design. Why this would be restricted is a great mystery.
You can do this, but because of the way Green works (it is a live round-tripping tool) it must be able to generate code for the composition when you draw the relationship. Green (or rather, the semantics of the composition relationship) is smart enough to realize that it cannot instantiate an interface. If you want to create a composition relationship between class A and interface I, which has as a concrete implementation B, Green will generate in class A:
an instance variable (field) of type I
an initialization of that variable to a new B() in A's constructor
I do notice, however, that there seems to be a problem with this in the 3.0.0 release, which is odd. We will look into this.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.