public class DelayedHk2InjectionManager extends AbstractHk2InjectionManager
InjectionManager
that is able to delay service's registration
and injection to completeRegistration()
phase. During the Jersey bootstrap just keep the bindings and other
operation for a later use.Modifier and Type | Field and Description |
---|---|
private AbstractBinder |
bindings |
private boolean |
completed |
private java.util.List<org.glassfish.hk2.utilities.Binder> |
providers |
Constructor and Description |
---|
DelayedHk2InjectionManager(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> bindings)
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
private final AbstractBinder bindings
private final java.util.List<org.glassfish.hk2.utilities.Binder> providers
private boolean completed
DelayedHk2InjectionManager(java.lang.Object parent)
parent
- parent of type InjectionManager
or ServiceLocator
.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> bindings)
InjectionManager
InjectionManager
is able to
register a bean represented by a class or direct instance.bindings
- 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) throws java.lang.IllegalArgumentException
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
.java.lang.IllegalArgumentException
- provider cannot be registered.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