Silk DI 0.6


se.jbee.inject
Interface Injector

All Known Implementing Classes:
Inject.SourcedInjector

public interface Injector

Knows how to *resolve* an instance for a given Dependency. The process of resolving might contain fabrication of instances. A Injector is immutable (at least from the outside view). Once created it provides a certain set of supported dependencies that can be resolved. All calls to resolve(Dependency) always have the same result for the same Dependency. The only exception to this are scoping effects (expiring and parallel instances).

Author:
Jan Bernitt (jan@jbee.se)

Method Summary
<T> T
resolve(Dependency<T> dependency)
           
 

Method Detail

resolve

<T> T resolve(Dependency<T> dependency)
          throws DIRuntimeException.NoSuchResourceException,
                 DIRuntimeException.MoreFrequentExpiryException,
                 DIRuntimeException.DependencyCycleException
Returns:
Resolves the instance appropriate for the given Dependency. In case no such instance is known an exception is thrown. The null-reference will never be returned.
Throws:
DIRuntimeException.NoSuchResourceException - In case no Resource in this injector's context matches the given dependency.
DIRuntimeException.MoreFrequentExpiryException - In case the resolution would cause the injection of a instance into another that has a higher Expiry.
DIRuntimeException.DependencyCycleException - In case the resolution caused a situation of cyclic dependent instances so that they cannot be injected.

Silk DI 0.6