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

前端 未结 4 1323
不思量自难忘°
不思量自难忘° 2020-12-03 11:16

i am developing a Java Api to do things (secret, uhhhh ;).

Is there a way to hide classes, and the internal structure of my API?

What i found until now:

4条回答
  •  爱一瞬间的悲伤
    2020-12-03 11:40

    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.

提交回复
热议问题