Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've created an interface in a class model. This interface has two methods, A and B and method A takes an argument (a) and method B does not take an argument (yet). Additionally I've created a class that implements this interface, overriding both methods.

After a discussing the model method B now should also take a parameter (b), so I modified the interface to reflect this change. However the class realizing this interface is not updated automatically. For one class it's possible to add the method by re-creating the link between the interface, specify the which method should be implemented and deleting this link again. Then the OLD method signature has to be removed as well. This is a lot of work if there is more then one class implementing the modified interface, not to mention error-prone.

Does anybody know how to make an entire class model update this type of dependency?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

I have also searched for the answer to this question, but apart from your post I didn't find anything. I posted a question on the EA Forum.

If it is for diagram purposes only, there 1 possible workaround (but a bit nasty):

  • Add your interface to the diagram as an (abstract) class with the <<interface>> stereotype
  • Add your class to the diagram as a class with the <<implementingClass>> stereotype
  • Add a generalization relationship from the class to the interface, don't select any checkbox in the Overrides & Updates
  • Hide the connector
  • Add a realization relationship from the class to the interface
  • Right-click on the class > Feature Visibility > check the Show Operations checkbox

As a result

  • The abstract class with look like an interface on the diagram
  • The implementing class will show the inherited operations
  • When adding operations to the interface, the class will be updated
  • When modifying operations on the interface, the class will be updated

The only problem is that during code generation an abstract class is generated instead of an interface.

share|improve this answer
    
This is the answer I was looking for, especially since I don't need to generate code from the diagram. Additionally it also works when removing a method from the interface. –  Timo Feb 15 '13 at 11:08
add comment

Select the class you want to refresh, and press Ctrl + Shift + o.

This link gives you a detailed explanation.

In Enterprise Architect, you can automatically override methods from parent Classes and from realized Interfaces.

Select a Class that has a parent or realized interface and select the Element | Advanced | Overrides & Implementations menu option.

In the Override Operations/Interfaces dialog, check the operations/interfaces to automatically override and click on the OK button. Enterprise Architect generates the equivalent function definitions in your child Class.

You can configure Enterprise Architect to display this dialog each time you add a Generalization or Realization connector between Classes, and review their possible operations/interfaces to override/implement. Do this from the Links page of the Options dialog (select the Tools | Options | Links menu option).

share|improve this answer
    
This does not cover adding or removing parameters from a method. Nor does it cover removing a method from the interface. Additionally this is still manual work which I am simply to lazy to do. –  Timo Feb 15 '13 at 11:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.