Java generics in method return value

General discussions about code engineering

Moderator: Moderators

Java generics in method return value

Postby tybalt » Mon Nov 21, 2011 9:41 am

I found some posts in this forum who described how to create Java generic attributes with "Language Properties --> Container". How do I create generic parameters (return values) for methods? The Language properties of the parameter does not show the Container option.

Forum Newbie
Forum Newbie
Posts: 5
Posts Rating:0
Joined: Fri Apr 29, 2011 3:04 am

Re: Java generics in method return value

Postby egiva » Fri Nov 25, 2011 9:10 am

Hello Bernhard,

Language Properties --> Container is available only for class properties. Major purpose of this Container property is to draw association to containing type in the diagram and make to generate java code with collection. Operation parameters do not need this functionality.
In order to have correctly modeled parameter type (or return parameter) you need to create bounded type with Template Binding first and then use this type for parameter. Please, check manual MagicDraw Code&DatabaseEngineering UserGuide on how to make such types. Check Type Variables and Parameterized Type chapters for mapping information
Best Regards,
Egidijus Vaisnora
Customer Support
Customer Support
Posts: 37
Posts Rating:0
Joined: Tue Jan 05, 2010 6:32 am

Return to Code engineering

Who is online

Users browsing this forum: No registered users and 1 guest