How to hide the internal structure of a Java API to the rest of the world

There are two solutions to your question that don’t involve keeping all classes in the same package.

The first is to use the Friend Accessor/Friend Package pattern described in (Practical API Design, Tulach 2008).

The second is to use OSGi.

Related Questions: 1, 2, 3, and 4.

Leave a Comment