a typical approach is to define a wrapper API (for example, interfaces) and include these interfaces in open source, and then provide configuration options where you can specify class names of classes that implement certain interfaces.
You import APIs instead of importing classes directly into your open source code. This way you open the API search, but do not implement parts that you do not want to open, or you cannot open the source.
There are many examples, but check out the JDBC (interfaces) and JDBC (implementation classes) APIs for starters.
source share