public class ImmediateHk2InjectionManager extends AbstractHk2InjectionManager
InjectionManager
that is able to register and inject services.Constructor and Description |
---|
ImmediateHk2InjectionManager(java.lang.Object parent)
Constructor with parent.
|
Modifier and Type | Method and Description |
---|---|
void |
completeRegistration()
Completes
InjectionManager and the underlying DI provider. |
void |
register(Binder binder)
Registers beans which are included in
Binder . |
void |
register(Binding binding)
Registers one bean represented using fields in the provided descriptor.
|
void |
register(java.lang.Iterable<Binding> descriptors)
Registers a collection of beans represented using fields in the provided descriptors.
|
void |
register(java.lang.Object provider)
Registers a provider.
|
createAndInitialize, createForeignDescriptor, getAllInstances, getAllServiceHolders, getInstance, getInstance, getInstance, getInstance, getInstance, getServiceLocator, inject, inject, isRegistrable, preDestroy, shutdown
ImmediateHk2InjectionManager(java.lang.Object parent)
parent
- parent of type InjectionManager
or ServiceLocator
.public void completeRegistration() throws java.lang.IllegalStateException
InjectionManager
InjectionManager
and the underlying DI provider. All registered components are bound to injection
manager and after an invocation of this method all components are available using e.g. InjectionManager.getInstance(Class)
.java.lang.IllegalStateException
public void register(Binding binding)
InjectionManager
InjectionManager
is able to register a bean
represented by a class or direct instance.binding
- one descriptor.ClassBinding
,
InstanceBinding
,
SupplierClassBinding
,
SupplierInstanceBinding
public void register(java.lang.Iterable<Binding> descriptors)
InjectionManager
InjectionManager
is able to
register a bean represented by a class or direct instance.descriptors
- collection of descriptors.ClassBinding
,
InstanceBinding
,
SupplierClassBinding
,
SupplierInstanceBinding
public void register(Binder binder)
InjectionManager
Binder
. Binder
can contains all descriptors extending
Binding
or other binders which are installed together in tree-structure. This method will get all descriptors
bound in the given binder and register them in the order how the binders are installed together. In the tree structure,
the deeper on the left side will be processed first.binder
- collection of descriptors.ClassBinding
,
InstanceBinding
,
SupplierClassBinding
,
SupplierInstanceBinding
public void register(java.lang.Object provider)
InjectionManager
InjectionManager
should test whether the type of the object can be
registered using the method InjectionManager.isRegistrable(Class)
. Then a caller has an certainty that the instance of the tested
class can be registered in InjectionManager
. If InjectionManager
is not able to register the provider
then IllegalArgumentException
is thrown.provider
- object that can be registered in InjectionManager
.