user2019510
user2019510

Reputation: 1470

object provides an interface in UML

I have three object :object1,objectA,objectB .

and also have an interface

How can I model as the following:

an object1 provides an interface from objectA to objectB

Upvotes: 2

Views: 745

Answers (2)

Sebastian K
Sebastian K

Reputation: 6373

If I understand your question correctly, that is you want to create an UML diagram in where one class implements interface (Producer) and another uses it (Consumer) then I would say you'd have few choices:

1) Denote inteface explicitely, and use realization relationship to indicate implementation of interface, and dependency relationship to indicate usage:

enter image description here

2) Use lollipop notation to denote exposed interface, and dependency to indicate usage.

enter image description here

3) Use ball and socket notation (UML 2.0)

enter image description here

Upvotes: 1

Eoin
Eoin

Reputation: 555

There are two immediate interpretations of what you want. Either you have an interface ("Interface1") that acts as a shared interface implemented by ClassA and ClassB OR you want the interface to be the way that ClassA and ClassB interact. I'm not sure which you mean.

In any case, the first option, where the interface is implemented by both is modelled like this: enter image description here

The second option, where the interface is used to allow interaction is modelled like this: Interface for interaction

Upvotes: 1

Related Questions