class A 和 B 之间的 UML 关系是什么,其中 A 使用 B 的方法创建其实例,然后在自己的 (A) class 中使用它?

What UML relationship is in between class A and B, where A uses methods of B to create its instance and then uses it inside own (A's) class?

class A 和 B 之间的 UML 关系是什么,其中 A 使用 B 的方法来创建其实例,然后在自己的 (A) class 中使用它? 它是一种依赖吗?例如 A ----------> B

例如在下面的代码中如何描述Sender和Invite之间的关系?

class Sender{

   public void sendInvite(){
     ....
     Invite i = Invite.getInstance();
     ....
   }

}

class Invite{
   ...
   public static Invite getInstance(){
     ...
   }
}

注意:一旦我们从方法 sendInvite() return,我们就不再存储任何 link 到 class 邀请。

从发件人到邀请的(定向)关联。由于您不使用 属性 而是使用局部变量,因此您不得为邀请使用角色名称。此外,您可能与 self for Invite 有关联,它(我猜)用于检索 getInstance().

内的单例实例

来自上层建筑 2.1.1 关于协会

An association specifies a semantic relationship that can occur between typed instances. It has at least two ends represented by properties, each of which is connected to the type of the end. More than one end of the association may have the same type.

An end property of an association that is owned by an end class or that is a navigable owned end of the association indicates that the association is navigable from the opposite ends; otherwise, the association is not navigable from the opposite ends.

...和依赖关系:

A dependency signifies a supplier/client relationship between model elements where the modification of the supplier may impact the client model elements. A dependency implies the semantics of the client is not complete without the supplier. The presence of dependency relationships in a model does not have any runtime semantics implications, it is all given in terms of the model-elements that participate in the relationship, not in terms of their instances.

在我看来可以表达为usage dependencies之一。画一个从 SenderInvite 的虚线箭头,用 «call» 或类似的东西标记它,然后继续