public interface DependencyContext
All data needed for creating an instance of a service.
The context contains only the services needed for the specific location, as provided by
ServiceInfo.dependencies()
.
-
Method Summary
Modifier and TypeMethodDescriptionstatic DependencyContext
create
(Map<Dependency, Object> dependencies) Create a new instance from a prepared map of dependencies.<T> T
dependency
(Dependency dependency) Obtain a parameter for a specific dependency.
-
Method Details
-
create
Create a new instance from a prepared map of dependencies.- Parameters:
dependencies
- map of dependency to an instance- Returns:
- context to use for creating instances of services
-
dependency
Obtain a parameter for a specific dependency. The dependency must be known in advance and provided throughServiceInfo
.- Type Parameters:
T
- type of the parameter, for convenience, the result is cast to this type- Parameters:
dependency
- the dependency metadata- Returns:
- value for the parameter, this may be null if allowed
-