You can also try the following attempt:
Use a dummy batch private interface and create a method in your public interface that returns it. Like this:
public interface I { Dummy getDummy();
Thanks to this, only classes from the current package can implement interface I All classes from outside will never be able to implement the Dummy getDummy() method. At the same time, classes outside the package will be able to use all other methods of the I interface that do not have a Dummy interface in their signature.
This solution is not beautiful, because you have one useless method in your I interface, but you should be able to achieve what you want.
source share