Package org.apache.cayenne.di.spi
Class DefaultInjector
java.lang.Object
org.apache.cayenne.di.spi.DefaultInjector
- All Implemented Interfaces:
- Injector
public class DefaultInjector extends Object implements Injector
A default Cayenne implementations of a DI injector.
- Since:
- 3.1
- 
Constructor SummaryConstructors Constructor Description DefaultInjector(Module... modules)
- 
Method SummaryModifier and Type Method Description <T> TgetInstance(Class<T> type)Returns a service instance bound in the container for a specific type.<T> TgetInstance(Key<T> key)Returns a service instance bound in the container for a specific binding key.<T> Provider<T>getProvider(Class<T> type)<T> Provider<T>getProvider(Key<T> key)voidinjectMembers(Object object)Performs field injection on a given object, ignoring constructor injection.voidshutdown()A lifecycle method that let's the injector's services to clean up their state and release resources.
- 
Constructor Details- 
DefaultInjector- Throws:
- DIRuntimeException
 
 
- 
- 
Method Details- 
getInstanceDescription copied from interface:InjectorReturns a service instance bound in the container for a specific type. ThrowsDIRuntimeExceptionif the type is not bound, or an instance can not be created.- Specified by:
- getInstancein interface- Injector
- Throws:
- DIRuntimeException
 
- 
getInstanceDescription copied from interface:InjectorReturns a service instance bound in the container for a specific binding key. ThrowsDIRuntimeExceptionif the key is not bound, or an instance can not be created.- Specified by:
- getInstancein interface- Injector
- Throws:
- DIRuntimeException
 
- 
getProvider- Specified by:
- getProviderin interface- Injector
- Throws:
- DIRuntimeException
 
- 
getProvider- Specified by:
- getProviderin interface- Injector
- Throws:
- DIRuntimeException
 
- 
injectMembersDescription copied from interface:InjectorPerforms field injection on a given object, ignoring constructor injection. Since Cayenne DI injector returns fully injected objects, this method is rarely used directly.Note that using this method inside a custom DI Providerwill most likely result in double injection, as custom provider is wrapped in a field-injecting provider by the DI container. Instead custom providers must initialize object properties manually, obtaining dependencies from Injector.- Specified by:
- injectMembersin interface- Injector
 
- 
shutdownpublic void shutdown()Description copied from interface:InjectorA lifecycle method that let's the injector's services to clean up their state and release resources. This method would normally generate a scope end event for the injector's one and only singleton scope.
 
-