Generics don't seem to be supported properly

Please use this forum to signal bugs.
Merci d'utiliser ce forum pour signaler des bugs.

Generics don't seem to be supported properly

Postby thomas.beale » Tue 17 Jun 2014 12:57

I'm trying to define a generic (parameterised) type. See attached example. I can make the class P_BMM_ENUMERATION generic - it has a 'T' parameter, but I can't see how to constrain T to another class, i.e. what would be something like T: COMPARABLE in the white box.

Also, when I create non-generic subtypes, I should be able to bind to a type. For example, P_BMM_ENUMERATION_INTEGER is a binding of P_BMM_ENUMERATION <INTEGER>, but there seems no way to do that.
Attachments
bouml_generics.png
bouml_generics.png (4.84 KiB) Viewed 9671 times
thomas.beale
 
Posts: 45
Joined: Wed 21 Mar 2012 21:37

Re: Generics don't seem to be supported properly

Postby Bruno Pagès » Tue 17 Jun 2014 14:15

thomas.beale wrote:I'm trying to define a generic (parameterised) type. See attached example. I can make the class P_BMM_ENUMERATION generic - it has a 'T' parameter, but I can't see how to constrain T to another class, i.e. what would be something like T: COMPARABLE in the white box.

you can give a default value of T but not constraint it

thomas.beale wrote:Also, when I create non-generic subtypes, I should be able to bind to a type. For example, P_BMM_ENUMERATION_INTEGER is a binding of P_BMM_ENUMERATION <INTEGER>, but there seems no way to do that.

just edit P_BMM_ENUMERATION_INTEGER and go to the tab "instantiate"

Look at http://www.bouml.fr/doc/index_class.html and search for "tab Instantiate"
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 585
Joined: Mon 20 Feb 2012 09:23
Location: France

Re: Generics don't seem to be supported properly

Postby thomas.beale » Wed 18 Jun 2014 09:27

Bruno,
with respect to the second question - constraining a type in a subtype - you are right, instantiation allows some classes to be chosen, but it only includes classes I have defined, not the primitive types. In this case, I want to put Int and String as the bound types, but I can't do that.
thomas.beale
 
Posts: 45
Joined: Wed 21 Mar 2012 21:37

Re: Generics don't seem to be supported properly

Postby Bruno Pagès » Wed 18 Jun 2014 09:46

Thomas, you aren't limited to the classes, like for the type of an attribute you can choose one of the proposed classes or enter any text you want
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 585
Joined: Mon 20 Feb 2012 09:23
Location: France


Return to Bug reports / Rapports de bugs

Who is online

Users browsing this forum: No registered users and 2 guests

cron