Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的 Java 类中,我有一些类似的东西private InterfaceName attributeName,这意味着它attributeName可能具有实现的任何类的对象InterfaceName。
private InterfaceName attributeName
attributeName
InterfaceName
我如何在 UML 类图中表示这种关系?对于一个普通的类,我已经解释了聚合,但我怀疑这是否也适用于接口。
谢谢。
In this context, the type of the field is the interface. In your UML you should have something like
variableName : InterfaceName
This informs someone reading the UML diagram that this particular variable accepts objects that implement a particular interface.