I have a class that implements two interfaces. One of this interfaces is defined in a second party jar and the other interface directly in my code.
Now I need to pass an object to a third party that only implements the interfaces I defined in my code. My doubt is if this will work just downcasting my object to the interface I define or even I downcast, this third party will still need the second party library as internally the class I pass still keeps a reference to the interface defined in the second party jar.
To visualize the scenario, some code...
Interface in my code:
public interface MyInterface {}
Interface in secondparty.jar:
public interface SecondpartyInterface {}
My object:
public MyObject implements MyInterface, SecondpartyInterface {}
Now the third party calls to a method in my code that should be something like:
private MyObject object;
public MyInterface getObject() {
return (MyInterface)object;
}
The third party has my.jar that contains MyInterface only. Will this work or the third party will need also the jar from the second party?
Thanks.