com.gluonhq.attach.util.Services refactored#20
com.gluonhq.attach.util.Services refactored#20DanskerDave wants to merge 2 commits intogluonhq:masterfrom
Conversation
|
As discussed in Mail with José Pereda |
|
Hi José, I've created a Fork & made 2 commits to it. Here's what I did (& didn't) change... Firstly, an observation: I have not addressed that at all. Here are the details of my changes: com.gluonhq.attach.util.impl.DefaultServiceFactory Class.forName never returns null (at least, according to Javadoc) -> superfluous null-check removed com.gluonhq.attach.util.Services The Javadoc of the registerServiceFactory(...) Method was incorrect. -> Javadoc corrected -> I added Objects.requireNonNull(factory.getServiceType()) to the Method The current get(...) Method always does a Lookup in FACTORY_MAP, -> I have removed the superfluous Lookup. Every time a Service is requested, its wrapped in a new Optional. -> Instead of wrapping the Service instance anew every time, -> also, I've commented the Method extensively -> the behaviour of the rewritten Method is identical to the old version. The new Java11+ Version has unreachable code: -> unreachable new RuntimeException(...) removed I've also included a Dummy SERVICE_NULL_ENTRY to speed things up even more. All the best, |
No description provided.