Book a Demo

Author Topic: Modelling overriding interface operations  (Read 2282 times)

apabil

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Modelling overriding interface operations
« on: March 06, 2012, 02:40:49 am »
Hello,

I am trying to model the overriding of an interface operation. The goal is to generate Java-Code out of the model. The operation-code should look like this:

Code: [Select]
button.addClickHandler(new ClickHandler(){
 public void onClick(ClickEvent event){
  do_something();
 }
});

I can't find out how to model the override of the onClick-operation in my activity diagram.
Is this possible with EA?

Thanks in advance,

apabil

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Modelling overriding interface operations
« Reply #1 on: March 12, 2012, 07:47:05 pm »
I found a simple solution.

By creating a subclass which implements the interface, it is possible to override the onClick-operation directly in the subclass. The method body can than be described by a activity diagram related to the onClick-operation in the subclass. In the activity diagram in the main class it is just necessary to create a instance of the subclass.
 
Best regards,