Return types, void and interfaces

I think I posted in the wrong place before!

I just got UML Lab for eclipse (Java) and I'm having a few issues that I can't find the answer to. I'm trying to add a method with a list as a return type. It would look like List, but UML Lab doesn't accept it. It also doesn't accept it when I try to set the return type as void. Also, I looked around but I cant find out how to add an interface to the diagram. Can anyone help?

Comments

  • Hi marianatuma,

    if you run into problems with element creation for your diagram you can always use UML Lab’s Round-Trip-Engineering NG feature to add elements.
    A tutorial how to use this feature can be found at http://www.uml-lab.com/de/uml-lab/videos/round-trip-engineering-ng-video/.
    Regarding your questions, an interface can be added to your classdiagram by simply right-click and drag the mouse inside your diagram. In the resulting pop-up you can select „Create Interface“ to add an Interface to the diagram. Alternatively you can select the „Interface“ tool using the Tool-Palette on the right-hand side of the diagram. If selected you are able to create an Interface using Drag&Drop while pressing the left mouse button.

    To add methods with a return type of multiple elements you can add a method to your Code and let the Reverse Engineering add it to your diagram. To add such a method directly to your diagram please ensure to have UML Lab 1.8.0 or above installed. Now it is possible to add a method with a Collection as return type by entering the method definition using the Direct-Editing-Feature.
    Example:
    We want to add the function „public Set<String> myFunc() {}“:
    1. Select the class or interface to edit
    2. Begin to type the method name (myFunc())
    3. Place a colon to separate the type specification (:)
    4. Begin to type „String“ and select the correct entry from the appearing list of proposals
    5. Enter the cardinalities for the return type (e.g. [0..*])
    So the complete String needed to add the method would be „myFunc():String[0..*]“.
    Press enter and see how the method is added to your diagram.
    To edit the cardinalities (e.g. to return only one String instead of a Collection of Strings) it is possible to use either direct editing or the Properties-View for the selected method.

    Best Regards,
    Lukas
Sign In or Register to comment.