Book a Demo

Author Topic: Type parameter in Interface elements  (Read 4505 times)

Rudi Adianto

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Type parameter in Interface elements
« on: August 30, 2010, 06:47:33 pm »
Hi,

Im a software architect currently evaluating EA.
This is my first day evaluating and everything looks good, except that it looks like "Interface" elements in class diagram cannot have type parameter.

For example i have this interface:

interface Wrapper<E> {
    public E getWrappedObject();
}

EA doesnt seem to agree with that interface definition.
I reversed that code into EA and when i forward engineered back to code, the generated code doesnt have the type parameter part.

How do I enable type parameter in Interface elements?

Thanks before,
Rudi

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Type parameter in Interface elements
« Reply #1 on: August 30, 2010, 06:52:43 pm »
Rudi,

AFAIK the reverse engineering doesn't support generics/parametrized classes.

Look here for an explanation on how to model those: http://www.sparxsystems.com/enterprise_architect_user_guide/modeling_languages/parameterisedclassestemplate.html

But I'm not sure how this will be reflected if you generate code from it.

Geert

pH

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: Type parameter in Interface elements
« Reply #2 on: August 30, 2010, 06:53:19 pm »
Reply fom sparx some time back on representing generics

************************************************
EA can represent and generate appropriate code for a collection from an association or aggregation using collection classes.  (See http://www.sparxsystems.com/uml_tool_guide/code_engineering/settingcollectionclasses.html)
 
In all other cases where you want to represent somewhere using an instantiation of a generic type, you will need to explicitly reference the full name, including the arguments.
 
If you are wanting to model your own generic classes, you can do so by following the instructions at http://www.sparxsystems.com/uml_tool_guide/uml_dictionary/parameterisedclassestemplate.html.
*************************************************

hth,
pH
<a href="http://webuml.org"><img src="http://webuml.org/images/webuml-badge.png" alt="Set UML Free!" style="border-width:0"></a>

Rudi Adianto

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Type parameter in Interface elements
« Reply #3 on: August 30, 2010, 08:16:32 pm »
Hi Geert and pH,

Thanks for the replies.
I looked at this page http://www.sparxsystems.com/enterprise_architect_user_guide/modeling_languages/parameterisedclassestemplate.html
but I cannot find any "Detail" tab on the Interface's properties popup.
EA does show "Detail" tab for a class' properties, but it does not for interface.
Am I missing something?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Type parameter in Interface elements
« Reply #4 on: August 30, 2010, 08:41:13 pm »
Rudi,

I don't think you are missing something.
I consider it a bug that the details tab is not available for interfaces.
You can report it using the link on the bottom of the page.
There might be a workaround however. I suspect EA will treat a class with "interface" stereotype pretty much the same as an actual interface.
It's worth a try...

Geert

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Type parameter in Interface elements
« Reply #5 on: August 31, 2010, 08:58:59 am »
Quote
I suspect EA will treat a class with "interface" stereotype pretty much the same as an actual interface.
No, it will not be treated as an interface anywhere.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Type parameter in Interface elements
« Reply #6 on: August 31, 2010, 03:53:55 pm »
I stand corrected.
EA indeed treats a class with "interface" stereotype (correctly) as any other class.

Geert