André André - 3 months ago 16
Java Question

Java Generics are modeled in ArgoUML with Template Parameter? How it works?

Suppose I have an operation that receives a parameter java Set and returns Set. How can I model that in ArgoUML? It seems I have to create a class “Set” with a Template Parameter, but I’m unable to find out how it works.

Answer

A good way of seeing what capabilities are supported in ArgoUML and how they map to the UI is to reverse engineer a simple example that does what you want. Templated classes (TemplateParameters, Bindings, etc) are incompletely implemented in ArgoUML 0.34 (the current release). If you reverse engineer a class using the generic placeholder E, you'll end up with not only a Template Parameter named E, but another class named E as well, so it's getting a little confused.

Unfortunately, I don't think the suggestion to use multiplicity (how you say things are multi-valued in UML) will work in this case because a) a Set has additional semantics regarding uniqueness, etc and b) you presumably want to show the generalization to java.util.Set, not just any old random set implementation.

You can see the placeholder for this in UI in the Template Parameters field at the bottom of the property panel for a Class. It will allow you to create a Template Parameter, but not do much else with it.

Probably the best you can do for right now is to just type your input and return parameters as plain old Set and forego the specificity of a strongly typed Set.