Should my internal API classes be all in one package?

前端 未结 3 1735
借酒劲吻你
借酒劲吻你 2021-01-05 00:07

I\'m hard at work packaging up an API for public consumption. As such I\'m trying to limit the methods that are exposed to only those that I wish to be public and supportabl

3条回答
  •  无人及你
    2021-01-05 00:48

    One example could be the Servlet API as you see they have separated common servlet API and http into two packages.

    If you separate your code in an api.jar and implementation.jar you could use interfaces for your implementation which are not visible to the users of api.jar. If objects of classes regardless of their package, have to collaborate in any way, the methods of course must be visible (at least in the implementation).

提交回复
热议问题