Package org.glassfish.jersey.inject.hk2
Class DelayedHk2InjectionManager
- java.lang.Object
-
- org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager
-
- org.glassfish.jersey.inject.hk2.DelayedHk2InjectionManager
-
- All Implemented Interfaces:
InjectionManager
public class DelayedHk2InjectionManager extends AbstractHk2InjectionManager
Implementation ofInjectionManagerthat is able to delay service's registration and injection tocompleteRegistration()phase. During the Jersey bootstrap just keep the bindings and other operation for a later use.
-
-
Field Summary
Fields Modifier and Type Field Description private AbstractBinderbindingsprivate booleancompletedprivate java.util.List<org.glassfish.hk2.utilities.Binder>providers
-
Constructor Summary
Constructors Constructor Description DelayedHk2InjectionManager(java.lang.Object parent)Constructor with parent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcompleteRegistration()CompletesInjectionManagerand the underlying DI provider.voidregister(java.lang.Iterable<Binding> bindings)Registers a collection of beans represented using fields in the provided descriptors.voidregister(java.lang.Object provider)Registers a provider.voidregister(Binder binder)Registers beans which are included inBinder.voidregister(Binding binding)Registers one bean represented using fields in the provided descriptor.-
Methods inherited from class org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager
createAndInitialize, createForeignDescriptor, getAllInstances, getAllServiceHolders, getInstance, getInstance, getInstance, getInstance, getInstance, getServiceLocator, inject, inject, isRegistrable, preDestroy, shutdown
-
-
-
-
Field Detail
-
bindings
private final AbstractBinder bindings
-
providers
private final java.util.List<org.glassfish.hk2.utilities.Binder> providers
-
completed
private boolean completed
-
-
Constructor Detail
-
DelayedHk2InjectionManager
DelayedHk2InjectionManager(java.lang.Object parent)
Constructor with parent.- Parameters:
parent- parent of typeInjectionManagerorServiceLocator.
-
-
Method Detail
-
register
public void register(Binding binding)
Description copied from interface:InjectionManagerRegisters one bean represented using fields in the provided descriptor. The final bean can be direct bean or factory object which will create the bean at the time of injection.InjectionManageris able to register a bean represented by a class or direct instance.- Parameters:
binding- one descriptor.- See Also:
ClassBinding,InstanceBinding,SupplierClassBinding,SupplierInstanceBinding
-
register
public void register(java.lang.Iterable<Binding> bindings)
Description copied from interface:InjectionManagerRegisters a collection of beans represented using fields in the provided descriptors. The final bean can be direct bean or factory object which will create the bean at the time of injection.InjectionManageris able to register a bean represented by a class or direct instance.- Parameters:
bindings- collection of descriptors.- See Also:
ClassBinding,InstanceBinding,SupplierClassBinding,SupplierInstanceBinding
-
register
public void register(Binder binder)
Description copied from interface:InjectionManagerRegisters beans which are included inBinder.Bindercan contains all descriptors extendingBindingor 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.- Parameters:
binder- collection of descriptors.- See Also:
ClassBinding,InstanceBinding,SupplierClassBinding,SupplierInstanceBinding
-
register
public void register(java.lang.Object provider) throws java.lang.IllegalArgumentExceptionDescription copied from interface:InjectionManagerRegisters a provider. An implementation of theInjectionManagershould test whether the type of the object can be registered using the methodInjectionManager.isRegistrable(Class). Then a caller has an certainty that the instance of the tested class can be registered inInjectionManager. IfInjectionManageris not able to register the provider thenIllegalArgumentExceptionis thrown.- Parameters:
provider- object that can be registered inInjectionManager.- Throws:
java.lang.IllegalArgumentException- provider cannot be registered.
-
completeRegistration
public void completeRegistration() throws java.lang.IllegalStateExceptionDescription copied from interface:InjectionManagerCompletesInjectionManagerand 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).- Throws:
java.lang.IllegalStateException
-
-