Java – what is the difference between required and Provided interfaces

interfacejavamodelingoopuml

I know in general :

an interface is a reference type, it is similar to a class,
that can contain only constants, method signatures, default methods, static methods, and nested types. Method bodies exist only for default methods and static methods. Interfaces cannot be instantiated—they can only be implemented by classes or extended by other interfaces ?

But what is the difference between required and Provided interfaces ?

Best Answer

Provided and required interface always refer to the concept of interface, indicating the point of view.

I hope the following diagrams sheds some light on the subject.

enter image description here

On the implementation level a provided interface is the interface implemented by a class (in the most common sense, e.g. a class B implements the interface I). Required interface would be any use of an interface by a component (e.g. if a class A defines a method that has the interface I as a parameter, this means that class A has a required interface I).