|
Interesting discussion. Indeed in the original ServiceManager we purposely did not care about having several implementations of a given contract.
From what I understand the need to split contract and implementation is driven by the serialization implementation use case, correct? I wonder, do you have other use cases in mind? The backends?
Do you plan to have a general purpose way to decide which impl to use for a given contract? You mentioned ServiceLoader which has IMO a less than elegant way of doing it: the contract accepts an input and returns an instance if it can deal with that input, returns null otherwise. The list of impl are iterated over until a suitable one is found. http://docs.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html
|