1

在我的 Java 类中,我有一些类似的东西private InterfaceName attributeName,这意味着它attributeName可能具有实现的任何类的对象InterfaceName

我如何在 UML 类图中表示这种关系?对于一个普通的类,我已经解释了聚合,但我怀疑这是否也适用于接口。

谢谢。

4

1 回答 1

0

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.

于 2013-02-26T12:29:00.143 回答