Interface DependencyContext


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 Type
    Method
    Description
    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

      static DependencyContext create(Map<Dependency,Object> dependencies)
      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

      <T> T dependency(Dependency dependency)
      Obtain a parameter for a specific dependency. The dependency must be known in advance and provided through ServiceInfo.
      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