Peter Panne
Peter Panne

Reputation: 485

UML - How I insert attributes which are objects from java classes?

)

My question is (class diagram):

E.g. I have two classes: classA and classB.

Now I would like to add three attributes to classB: int a; int b; classA test;

That is no Problem because every UML tool know the primitive datatypes and the classes which I have already implemented in my UML diagramm. I can chose classA as Data Type in the popup menu.

But what is when I used Java classes as attributes in my classes, e.g.:

final ExecutorService threadPool;

ExecutorService is no primitive datatypes and no class which I implemented. It is a class of a java libery. So it is not shown in my data type popup menu if I would like to add new attributes.

What is the standard way to solve this problem? Sure I could add a class ExecutorService but ExecutorService is not part of my written code but rather of a java libery. In some tools your are able to add data types but I think that is also the wrong way because it is an class.

What would you suggest?

Thank you:-)

Upvotes: 0

Views: 1349

Answers (2)

Red Beard
Red Beard

Reputation: 3506

I will share with you how I do this but I am not sure that is a standard way maybe it is more related to the used tools...

I use Modelio for my Java development and all my referenced libraries are Modelio model components. So, in short, they are classically modeled as UML packages, classes, operations, etc. (coming from a Java reverse) and deployed in my project in read only. So they can referenced them (by an attribut for example) but they are not modificable and not "really" parts of my code which seems, for me, close to Java library concept.

Hoping it helps.

Regards,

RB

Upvotes: 1

nif
nif

Reputation: 3442

If you want to show the dependencies between your classes, there is usually no need to include framework classes like ExecutorService at all. I would say that's an implementation detail, in this case.

However, if you want to show more details, it should be no problem to include the class. Create an association to the ExecutorService class if your UML tool really can't express custom data types. You could highlight (or gray out) the framework classes, which may make your diagram more readable.

The granularity highly depends on the audience the diagram is intended for.

References:

Upvotes: 0

Related Questions