August 2017
Beginner
298 pages
7h 26m
English
Look at the sample code at 09-module-patterns/04-optional-dependencies-with-services.We have two modules, pattern.four and pattern.four.optlib. We want pattern.four to optionally depend on pattern.four.optlib using the services pattern we've seen so far.
The module pattern.four contains a service type LibInterface that it exports. It also declares that it uses provider implementations of LibInterface, which is what essentially makes LibInterface a service type:
module pattern.four {
exports pattern.four.external;
uses pattern.four.external.LibInterface;
}
The module pattern.four.optlib provides an implementation of the LibInterface service type. It also depends on pattern.four to access the service type in the first place. This ...
Read now
Unlock full access