Author Topic: Generic Interface  (Read 304 times)

uml.modeller

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Generic Interface
« on: September 22, 2009, 12:42:42 am »
Hi,

I'm trying to model payments integration for an enterprise Java e-commerce system. The system I've designed uses a generic interface in order to support a number of different payment types:

public interface PaymentGateway<T extends Payment> {
 ...
}

However, unlike classes, I can't find a way to parameterise a interface as there is no "details" tab in the properties dialog for interfaces. Is it possible to do this?

In addition, what's the best way to show the type specified by an implementing class? For example:

public class AuthorizeNetGateway
       †implements PaymentGateway<CreditCardPayment> {
 † †...
}
« Last Edit: September 22, 2009, 02:04:12 am by uml.modeller »

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Generic Interface
« Reply #1 on: September 22, 2009, 02:28:24 am »
Hi,

For your 1st question I'm afraid it's actually not supported for interfaces. There was a recent thread here on the same topic.

Regarding your 2nd question, you can specialize generic classes using the Arguments textbox that can be found on the Class Details Dialog (near the bottom). I don't know what java code generation does, but for C++ code generation it works like this.

HTH,
GŁnther

uml.modeller

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: Generic Interface
« Reply #2 on: September 22, 2009, 03:14:32 am »
Thanks,

For diagramming purposes I think I'll just use a dirty hack and represent my generic interface as a class and stereotyping it with <<interface>>.