Book a Demo

Author Topic: Paramterised classes (templates)  (Read 3443 times)

frankk

  • EA User
  • **
  • Posts: 96
  • Karma: +0/-0
    • View Profile
Paramterised classes (templates)
« on: May 14, 2008, 01:49:13 am »
Has anyone used these? I can define the class, but I would like to add a 'bound class', as well. I.e., a class that inherits from the template and binds a specific class to the parameter. In various books (e.g., O'Reilly's UML 2.0 in a Nutshell), this is shown with a <<bind>> stereotype followed by: <T=xyz>, where 'xyz' is a class name.

Is there a way to do this directly in EA?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Paramterised classes (templates)
« Reply #1 on: May 14, 2008, 09:11:44 am »
The stereotype bind is available on depenency connectors.  (Context Menu | Advanced | Dependency Stereotypes).

EA code generation doesn't use it and you're left with setting the name of the dependency to '<T=xyz>'.
« Last Edit: May 14, 2008, 09:12:00 am by simonm »

frankk

  • EA User
  • **
  • Posts: 96
  • Karma: +0/-0
    • View Profile
Re: Paramterised classes (templates)
« Reply #2 on: May 14, 2008, 10:50:21 pm »
Thanks, that's what I expected :-(
By the way, though, the books and websites I've looked at show it as inheritance rather than a dependency. Dependency appears to be the standard.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Paramterised classes (templates)
« Reply #3 on: May 15, 2008, 10:59:01 am »
I haven't look at the spec for this recently but I think that showing bind on a generalization is a shorthand as shown below.

| Child | ------------------ <<bind>> Generalization ------------------> | Parent |

| Child |  --- Generalization ---> | Anonymous Class | - - <<bind>> - - > | Parent |