I'm working on a library that has quite a few classes that are all pulled together by a central class. This central class has to call certain methods on the other classes for set-up/configuration purposes. These methods have to be public so that the central class can call them, but I do not want users to call these methods (as it may cause undesired behavior).
One suggestion a friend of mine made was to use a constructor with parameters can have the set-up done at construction time. For the purposes of this library, that is not easily possible. The classes in question are intended to be extended, and I didn't want to impose any weird requirements on constructor parameters if the users want to have their own constructors. Even more complicated is that some of the information used for configuration isn't available to the user. I would have to make it available to the user and trust they will route it back to the proper classes during construction.
Currently, my solution is to prefix these methods with something and note to users not to call methods with said prefix. This is "flexible" enough to let me add more restricted methods, but it still makes the assumption that the user will follow my instructions. It's also not the most elegant of solutions.
I was wondering if there was some way to restrict these methods easily. I thought about adding a line in them that checked if it was the central class calling them, but that doesn't seem like the best solution either.
Edit: I should explain the purpose of this architecture. The classes each perform a particular task in a stack of operations. The job of the central class is to command one class to perform it's task, gather results, and disperse the results to the other classes that need them. Then the class moves to the next class and does the same thing. How the tasks are performed is up to the extended class. The methods I want restricted are the ones that aid in the dispersing of the results. I hope that makes my intentions more clear.