This question has been asked similary here: Java: Subpackage visibility?
My current package structure is:
src/
| library/
| | InterfaceA.java
| | ClassB.java
| | provider/
| | | ClassofInterfaceA.java
| user/
| | UsageOfClassofInterfaceA.java
So the ClassOfInterfaceA.java uses Methods from ClassB.java and implements the Interface.java.
Our user, who has created the class UsageOfClassOfInterfaceA.java, should only be able to access methods from ClassOfInterfaceA.java. He shouldn't be able to access any class/interface/variable or method from the Library package.
Since the answers of the linked question more aim towards the junit tests and how the IDE uses those, I couldn't find any answers.
Please don't recommend any other package structure since this is predefined by our lecturer.
Thanks in advance :)
EDIT: since it has been asked, all the classes are currently public, because I can't address them through my ClassOfInterfaceA.java. I also have to use Java8.
To address the factory, the ClassOfInterfaceA.java will be used by an UI to demonstrate their usage. So UsageOfClassOfInterfaceA.java is essentially a UI class.