Getting Further Modulerizing with Jigsaw in NetBeans IDE
By Geertjan-Oracle on May 22, 2016
Here's the use case, i.e., a small Anagram game:
The category can be switched via the drop-down:
The point of this blog entry is that "Technical" and "Animal" are both made available via service providers, each made available by a different Jigsaw module, "org.wordlibrary.technical" and "org.wordlibrary.animal":
Each of the service providers serve up an implementation of the same service, "com.wordlibrary", consumed by "com.toy anagrams".
The point is that the application is now pluggable. Simply introduce onto the module path new Jigsaw modules that implement the service and register them using their "module-info.java" class, as discussed earlier. It's all very similar to META-INF/services, except that here we're using modules instead of libraries, with all the advantages that modules bring over libraries, in particular the ability to hide the internals of a module from unintended access.
Pretty cool to have applied all the concepts discussed in the previous blog entry to a real example and it works.