Package org.int4.dirk.spi.instantiation
Interface InstanceProvider<T,E>
-
- Type Parameters:
T- the type handledE- the element type required
public interface InstanceProvider<T,E>Provides instances of typeTcreated from elements of typeE.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TgetInstance(Instance<E> instance)Creates an instance of typeTusing the givenInstance.
-
-
-
Method Detail
-
getInstance
T getInstance(Instance<E> instance)
Creates an instance of typeTusing the givenInstance. Returningnullis allowed to indicate the absence of a value. Depending on the destination where the value is used this can meannullis injected (methods and constructors), that the value is not injected (fields) or that anUnsatisfiedResolutionExceptionis thrown (direct instance resolver call).- Parameters:
instance- anInstance, cannot benull- Returns:
- an instance of type
T, can benull - Throws:
CreationException- when the instance could not be createdAmbiguousResolutionException- when multiple instances matched but at most one was requiredUnsatisfiedResolutionException- when no instance matched but at least one was requiredScopeNotActiveException- when the scope for the produced type is not active
-
-