Constructor in visual paradigm - uml

How can you take a HashMap of type, for example, <Person,Integer>, as a parameter for the constructor in class diagrams? Every time I try in visual paradigm, it gives an error.

I am not sure what error you were getting, but what you wanted to achieve can be done by performing the steps in Visual Paradigm.
Add a constructor into the class by right clicking on the class and selecting Add > Constructor.
Right click on the constructor and select Open Specification...
Under the Parameters tab, click Add...
Enter the parameter name, enter java.util.HashMap as type and as Type modifier. If you want only a diagram for presentation purpose without the need of code generation, you may enter HashMap without entering 'java.util.HashMap'
Done!
The article below provides you with more information about their Class Diagram support. Hope this helps.
https://circle.visual-paradigm.com/docs/uml-and-sysml/class-diagram/how-to-draw-a-class-diagram-in-uml/

Do you mean something like this?

Related

How to draw the UML diagram which representing invocations between methods in the same class inheritance tree? [duplicate]

I have a child class which wants to add more functionality to a base class function, how can I represent that it also does the base class function not just the newly added functionality?
Interesting question. I tried that with Enterprise Architect. It did let me select the parent's operation but the display in the diagram did not change. It seems like you need to use notes for that:
As you can see Class2 inherits from Class1. The SD shows a call to Class2's operation a(). The call to the super-class's Class1.a() as internal call shows the same signature. A note clarifies the situation.
Maybe there's something else possible with this. But that's what I came up with immediately.
P.S. I've looked up the specs. P. 575 of UML 2.5 says
The message-name appearing in a request-message-label is the name property of the Message. If the Message has a signature, this will be the name of the Operation or Signal referenced by the signature. Otherwise the name is unconstrained.
That would put in the option to specify the operation in question as Class1:a() or the like. Actually Enterprise Architect shows it that way in the properties of the message but shortens it to just the basic name. Just a border case, I'd guess.

How to represent calling base class method in overridden method?

I have a child class which wants to add more functionality to a base class function, how can I represent that it also does the base class function not just the newly added functionality?
Interesting question. I tried that with Enterprise Architect. It did let me select the parent's operation but the display in the diagram did not change. It seems like you need to use notes for that:
As you can see Class2 inherits from Class1. The SD shows a call to Class2's operation a(). The call to the super-class's Class1.a() as internal call shows the same signature. A note clarifies the situation.
Maybe there's something else possible with this. But that's what I came up with immediately.
P.S. I've looked up the specs. P. 575 of UML 2.5 says
The message-name appearing in a request-message-label is the name property of the Message. If the Message has a signature, this will be the name of the Operation or Signal referenced by the signature. Otherwise the name is unconstrained.
That would put in the option to specify the operation in question as Class1:a() or the like. Actually Enterprise Architect shows it that way in the properties of the message but shortens it to just the basic name. Just a border case, I'd guess.

How to create abstract class in MagicDraw

I'm newbie in MagicDraw and I'd like to know how to specify a class as {abstract}.
I know about de property "Is abstract" in the Specification of Class, but I'd like that it appears in the header.
The place where you set isAbstract in MagicDraw is in the specification window for the class. To open that window, either right-click on the class or press enter while it is selected. The window will look like this:
You didn't specifically ask for more information, but I'll provide it in case you find it helpful.
The model you want to create will look like this:
Notice that Abstract Class is written in italics to indicate it is abstract. Also notice that {complete, disjoint} is specified for the generalization set. (Just FYI, {complete} is also known as a covering axiom.)
Beware that if you do not specify {complete}, you're creating a conflict with the isAbstract meta-property. The reason there's a conflict is that in UML, the default is {incomplete}, which means that you are allowed to create an instance of the super-class without it also being an instance of one of the sub-classes. That conflicts with isAbstract.

Is there option to show attributes of operations in Rational Software Architect?

I'm fairly new to Rational Software Architect and it annoys the hell out of me that I can't see attributes of operations (methods) in UML diagrams. If I add method called get() with attributes att1 and att2, I'd like to see get(In att1, In att2) on diagram.
Is there a possibility to show this by default?
Right click on a class -> "Filters" -> "Show Signature".
Click on the class diagram background and then use the show hide compartment option. You have attributes and methods compartments which need to selected in order to be displayed graphically.
It worked pretty well last time I evaluated the Rational tools.

Star UML: how to add get/set properties

I have started using Star UML application and its great. Is there a way to add get/set functions and foward/reverse engineer the code.
Thanks
Create an operator then set the stereotype to CSharpProperty.
Example:
Right-click the class in the Model Explorer
Select Add -> Operation
In the property pane add the CSharpProperty stereotype.
Add a "return" parameter (right-click the new operation and select Add -> return)
Set the Type to the property type (e.g. int, string, etc.)
Set the DiretionKind to Return
The above steps should produce C# code with both an accessor and modifier when StarUML generates the code.
You just need to install a tool named "Generate Getters and Setters".
Open the StarUML and select Tools -> Extension Manager...
Search "Generate Getters and Setters" and install it
Reload the StarUML
Select attributes or classes first and then select Tools -> Generate Getters Setters(Ctrl+Alt+G)
staruml-gettersetter in GitHub
I don't think that there is an easy way for automation in generating getters and setters.
The development of StarUML stopped 4 years ago. An alternative would be nice.

Resources