I have a manager class that is responsible for managing objects of a certain type. To do this, he needs to manipulate these objects, but these objects have nothing to do with the manager, so technically design them in separate packages "project.managers" and "project.objects". The important thing is that the objects in question should be managed only by managers and nowhere else, but should be accessible to all other classes of the project.
As such, I would like managers to have access to method manipulation, but to restrict access to all other classes. The most obvious would be to move the manager class and the object class into the same package and declare protected manipulation methods, but since managers and objects are completely separate objects, they are not philosophical.
(This is partly due to the fact that I want my IDE to stop showing me manipulation methods whenever I autocomplete the code for the objects in question, so I always need to go through the dispatcher so that the corresponding tables are correctly updated every time when I change objects in question).
Are there any ideas for this, or is the obvious way the best way anyway?
source share