I have an DataMapper class which has some private and public methods. The DataMapper class itself is in the system layer because it is auto-generated code. The user (developer) uses the DataMapper class in the domain layer (or business logic layer).

There are some methods of the DataMapper which are used only by the framework, and which I don't want to expose to the user. However, I can't make these methods private or protected, because the framework classes must be able to call these. But the user should not.

One option I thought about was to:

1) add an \_ underscore in front of the method name, to indicate it's "private API".

2) add an parameter called "key" to the method: The entire framework knows a secret key which it passes along these methods. The method evaluates the key. If it's ok, the method executes, otherwise it throws an exception.

How could I separate the visibility of these methods in my layers? Must I look at interfaces?