Search code examples
javainterfaceargumentsumldiagram

Constructor with interface arguments in Java Class Diagrams


I have a Interface in my project like,

public interface TraOp{
}

Now in class A I use this interface as argument in constructor like,

class A implements B{
   
   private long var1;
   A(TraOp obj){}
}

Can someone let me know how this will be presented in class diagram.


Solution

  • In UML:

    • a class A that implements an interface B has a realization dependency. This is represented like inheritance, but a dashed line as explained by saka1029.

    • a class A that used TrapOp, for example as parameter in has a usage dependency, noted with the «use» keyword.

    enter image description here