Class InjectorImpl
- All Implemented Interfaces:
- Injector
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected <U> InjectorbindImplicit(Class<?> clazz) Registers a class for implicit binding.<U> InjectorbindInstance(Class<U> clazz, U instance) Binds a specific instance to a class type.bindScope(Class<? extends Annotation> scopeAnnotation, Supplier<Scope> scope) Binds a scope annotation to a supplier that creates scope implementations.bindScope(Class<? extends Annotation> scopeAnnotation, Scope scope) Binds a scope annotation to its implementation.protected <Q> Supplier<Q> discover(ClassLoader classLoader) Configures the injector to discover injectable components from the specified ClassLoader.protected voiddoBindImplicit(Key<?> key, Binding<?> binding) <Q> Supplier<Q> doGetCompiledBinding(Dependency<Q> dep) getBindings(Key<T> key) <Q> Supplier<Q> getCompiledBinding(Dependency<Q> dep) <T> TgetInstance(Class<T> key) Retrieves or creates an instance of the specified type.<T> TgetInstance(Key<T> key) Retrieves or creates an instance for the specified key.<T> voidinjectInstance(T instance) Performs field and method injection on an existing instance.protected <Q,T> List <Q> protected <K,V, T> Map <K, V> 
- 
Constructor Details- 
InjectorImplpublic InjectorImpl()
 
- 
- 
Method Details- 
getInstanceDescription copied from interface:InjectorRetrieves or creates an instance of the specified type.- Specified by:
- getInstancein interface- Injector
- Type Parameters:
- T- the type to retrieve
- Parameters:
- key- the class representing the type to retrieve
- Returns:
- an instance of the requested type
 
- 
getInstanceDescription copied from interface:InjectorRetrieves or creates an instance for the specified key.This method allows retrieval of instances with specific qualifiers or generic type parameters. - Specified by:
- getInstancein interface- Injector
- Type Parameters:
- T- the type to retrieve
- Parameters:
- key- the key identifying the instance to retrieve
- Returns:
- an instance matching the requested key
 
- 
injectInstanceDescription copied from interface:InjectorPerforms field and method injection on an existing instance.This method will inject dependencies into annotated fields and methods of the provided instance but will not create a new instance. - Specified by:
- injectInstancein interface- Injector
- Type Parameters:
- T- the type of the instance
- Parameters:
- instance- the instance to inject dependencies into
 
- 
discoverDescription copied from interface:InjectorConfigures the injector to discover injectable components from the specified ClassLoader.This method scans for classes annotated with injection-related annotations and automatically registers them with the injector. 
- 
bindScope@Nonnull public Injector bindScope(@Nonnull Class<? extends Annotation> scopeAnnotation, @Nonnull Scope scope) Description copied from interface:InjectorBinds a scope annotation to its implementation.This allows custom scopes to be registered with the injector. The scope annotation must be annotated with Scope.
- 
bindScope@Nonnull public Injector bindScope(@Nonnull Class<? extends Annotation> scopeAnnotation, @Nonnull Supplier<Scope> scope) Description copied from interface:InjectorBinds a scope annotation to a supplier that creates scope implementations.Similar to Injector.bindScope(Class, Scope)but allows lazy creation of scope implementations.
- 
bindInstanceDescription copied from interface:InjectorBinds a specific instance to a class type.This method allows pre-created instances to be used for injection instead of having the injector create new instances. - Specified by:
- bindInstancein interface- Injector
- Type Parameters:
- U- the type of the instance
- Parameters:
- clazz- the class to bind to
- instance- the instance to use for injection
- Returns:
- this injector instance for method chaining
 
- 
bindImplicitDescription copied from interface:InjectorRegisters a class for implicit binding.Implicit bindings allow the injector to create instances of classes without explicit binding definitions. The class must have appropriate injection annotations. - Specified by:
- bindImplicitin interface- Injector
- Parameters:
- clazz- the class to register for implicit binding
- Returns:
- this injector instance for method chaining
 
- 
bind
- 
getBindings
- 
getBoundKeys
- 
getBindings
- 
getCompiledBinding
- 
doGetCompiledBinding
- 
compile
- 
doBindImplicit
- 
map
- 
list
 
-