Search code examples
javaumldiagram

UML to Java code - Multiplicity Indicator and capitalized variable


I am learning UML and I need to transform a given UML diagram to java code. I already created the Manager class, the Account class and the Ident interface.

I marked the parts that i do not understand yet in yellow. Concerning the Account class i do not understand what AccountCounts is. I thought it could be a private static int instance variable, but it makes no sense that it is written with an uppercase letter at the beginning then. So i thought it is an inner class, but this does not make sense neither.

I also do not know if it is possible to represent the multiplicity in code. I get the idea that 1 Manager Object can use multiple Objects of the type Account. But i am not sure how 1 Manager Object can work with Ident Objects, since this is an interface. I can't even create an instance of an Interface, can i?

Thanks in advance.

enter image description here


Solution

  • What Geert said. Anyhow:

    • Ask the author of the UML why he capitalized AccountCounts. As you assumed it's a static local attribute.
    • Multiplicity can be expressed in many ways. If you have low multiplicities you can instantiate a var1, var2, etc. Or you use lists as you did.
    • The names you marked are names of the association (which I never found very useful for my modeling). They probably should be role names but they aren't. If so they need to be near the far end (here to the right) and have a visibility indicator (++, -, etc.) in front.