Author Topic: Template interfaces classes  (Read 1922 times)

whgibbo

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Template interfaces classes
« on: January 23, 2012, 10:14:58 pm »
Hi,
Some questions regarding template classes/interfaces..

I have created a template interface in Enterprise Architect and generated the code for it.. Which produced the following java..

public interface GenericDao<T> {
      public T getById(
            Connection connection,
            int id
      );
}


I now want to create a UML classes that implements this interface..
So I did the following:
  • Dragged a new class(TestDAO) onto the class diagram class
  • Then dragged the realize line from the new class(TestDAO) onto the interface(GenericDao)
  • Selected all the operations
  • Operations appeared in the new class, but return type was still T.
  • Edited the properties on the new class(TestDAO), went to properties->Templates.
  • Added a binding of T->TestDAO
  • No change to the model.
  • Generated code for new class(TestDAO), which generated
public class EEOOBActionQueueDao implements GenericDao<EEOOBActionQueue> {

      public TestDao(){

      }
      public
T getById(
            Connection connection,
            int id
      ){
            return null;
      }

[/list]

I also tried using template binding, but no joy... :(  As it didn't allow me to select the operations..




whgibbo

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Template interfaces classes
« Reply #1 on: January 26, 2012, 08:43:26 pm »
Does anybody have any ideas ?