public class ImmediateHk2InjectionManager extends Object
InjectionManager
that is able to register and inject services.Modifier and Type | Method and Description |
---|---|
void |
completeRegistration()
Completes
InjectionManager and the underlying DI provider. |
<U> U |
create(Class<U> clazz)
Creates an object with the given class.
|
<U> U |
createAndInitialize(Class<U> clazz)
Creates, injects and post-constructs an object with the given class.
|
org.glassfish.jersey.internal.inject.ForeignDescriptor |
createForeignDescriptor(org.glassfish.jersey.internal.inject.Binding binding)
Creates and registers the descriptor in the underlying DI provider and returns
ForeignDescriptor that is specific
descriptor for the underlying DI provider. |
<T> List<T> |
getAllInstances(Type clazz)
Gets all services from this injection manager that implement this contract or have this implementation.
|
<T> List<org.glassfish.jersey.internal.inject.ServiceHolder<T>> |
getAllServiceHolders(Class<T> contract,
Annotation... qualifiers)
Gets all services from this injection manager that implements this contract or has this implementation along with
information about the service which can be kept by
ServiceHolder . |
<T> T |
getInstance(Class<T> clazz)
Gets the best service from this injection manager that implements this contract or has this implementation.
|
<T> T |
getInstance(Class<T> clazz,
Annotation... annotations)
Gets the best service from this injection manager that implements this contract or has this implementation.
|
<T> T |
getInstance(Class<T> clazz,
String classAnalyzer)
Gets the best service from this injection manager that implements this contract or has this implementation.
|
Object |
getInstance(org.glassfish.jersey.internal.inject.ForeignDescriptor foreignDescriptor)
Gets the service instance according to
ForeignDescriptor which is specific to the underlying DI provider. |
<T> T |
getInstance(Type clazz)
Gets the best service from this injection manager that implements this contract or has this implementation.
|
ServiceLocator |
getServiceLocator() |
void |
inject(Object injectMe)
Analyzes the given object and inject into its fields and methods.
|
void |
inject(Object injectMe,
String classAnalyzer)
This will analyze the given object and inject into its fields and methods.
|
boolean |
isRegistrable(Class<?> clazz)
Tests whether the provided
clazz can be registered by the implementation of the InjectionManager . |
boolean |
isShutdown()
|
void |
preDestroy(Object preDestroyMe)
Analyzes the given object and call the preDestroy method.
|
void |
register(org.glassfish.jersey.internal.inject.Binder binder)
Registers beans which are included in
Binder . |
void |
register(org.glassfish.jersey.internal.inject.Binding binding)
Registers one bean represented using fields in the provided descriptor.
|
void |
register(Iterable<org.glassfish.jersey.internal.inject.Binding> descriptors)
Registers a collection of beans represented using fields in the provided descriptors.
|
void |
register(Object provider)
Registers a provider.
|
void |
shutdown()
Shuts down the entire
InjectionManager and the underlying DI provider. |
public void completeRegistration() throws IllegalStateException
org.glassfish.jersey.internal.inject.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)
.IllegalStateException
public void register(org.glassfish.jersey.internal.inject.Binding binding)
org.glassfish.jersey.internal.inject.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(Iterable<org.glassfish.jersey.internal.inject.Binding> descriptors)
org.glassfish.jersey.internal.inject.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(org.glassfish.jersey.internal.inject.Binder binder)
org.glassfish.jersey.internal.inject.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(Object provider)
org.glassfish.jersey.internal.inject.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
.public ServiceLocator getServiceLocator()
public boolean isRegistrable(Class<?> clazz)
org.glassfish.jersey.internal.inject.InjectionManager
clazz
can be registered by the implementation of the InjectionManager
.isRegistrable
in interface org.glassfish.jersey.internal.inject.InjectionManager
clazz
- type that is tested whether is registrable by the implementation of InjectionManager
.true
if the InjectionManager
is able to register this type.public <T> List<org.glassfish.jersey.internal.inject.ServiceHolder<T>> getAllServiceHolders(Class<T> contract, Annotation... qualifiers)
org.glassfish.jersey.internal.inject.InjectionManager
ServiceHolder
.getAllServiceHolders
in interface org.glassfish.jersey.internal.inject.InjectionManager
T
- Instance type.contract
- May not be null, and is the contract or concrete implementation to get the best instance of.qualifiers
- The set of qualifiers that must match this service definition.public <T> T getInstance(Class<T> clazz, Annotation... annotations)
org.glassfish.jersey.internal.inject.InjectionManager
Use this method only if other information is not needed otherwise use, otherwise use
InjectionManager.getAllServiceHolders(Class, Annotation...)
.
getInstance
in interface org.glassfish.jersey.internal.inject.InjectionManager
T
- Instance type.clazz
- May not be null, and is the contract or concrete implementation to get the best instance of.annotations
- The set of qualifiers that must match this service definition.public <T> T getInstance(Type clazz)
org.glassfish.jersey.internal.inject.InjectionManager
Use this method only if other information is not needed otherwise use, otherwise use
InjectionManager.getAllServiceHolders(Class, Annotation...)
.
getInstance
in interface org.glassfish.jersey.internal.inject.InjectionManager
T
- Instance type.clazz
- May not be null, and is the contract or concrete implementation to get the best instance of.public Object getInstance(org.glassfish.jersey.internal.inject.ForeignDescriptor foreignDescriptor)
org.glassfish.jersey.internal.inject.InjectionManager
ForeignDescriptor
which is specific to the underlying DI provider.getInstance
in interface org.glassfish.jersey.internal.inject.InjectionManager
foreignDescriptor
- DI specific descriptor.public <T> T getInstance(Class<T> clazz)
org.glassfish.jersey.internal.inject.InjectionManager
Use this method only if other information is not needed otherwise use, otherwise use
InjectionManager.getAllServiceHolders(Class, Annotation...)
.
getInstance
in interface org.glassfish.jersey.internal.inject.InjectionManager
T
- Instance type.clazz
- May not be null, and is the contract or concrete implementation to get the best instance of.public <T> T getInstance(Class<T> clazz, String classAnalyzer)
org.glassfish.jersey.internal.inject.InjectionManager
Use this method only if other information is not needed otherwise use, otherwise use
InjectionManager.getAllServiceHolders(Class, Annotation...)
.
getInstance
in interface org.glassfish.jersey.internal.inject.InjectionManager
T
- Instance type.clazz
- May not be null, and is the contract or concrete implementation to get the best instance of.classAnalyzer
- -------public <T> List<T> getAllInstances(Type clazz)
org.glassfish.jersey.internal.inject.InjectionManager
Use this method only if other information is not needed otherwise use, otherwise use
InjectionManager.getAllServiceHolders(Class, Annotation...)
.
getAllInstances
in interface org.glassfish.jersey.internal.inject.InjectionManager
T
- Instance type.clazz
- May not be null, and is the contract or concrete implementation to get the best instance of.public void preDestroy(Object preDestroyMe)
org.glassfish.jersey.internal.inject.InjectionManager
preDestroy
in interface org.glassfish.jersey.internal.inject.InjectionManager
preDestroyMe
- The object to preDestroypublic void shutdown()
org.glassfish.jersey.internal.inject.InjectionManager
InjectionManager
and the underlying DI provider.
Shutdown phase is dedicated to make some final cleaning steps regarding underlying DI provider.
shutdown
in interface org.glassfish.jersey.internal.inject.InjectionManager
public boolean isShutdown()
org.glassfish.jersey.internal.inject.InjectionManager
isShutdown
in interface org.glassfish.jersey.internal.inject.InjectionManager
InjectionManager
has been shutdown.public <U> U create(Class<U> clazz)
org.glassfish.jersey.internal.inject.InjectionManager
The object created is not managed by the injection manager.
create
in interface org.glassfish.jersey.internal.inject.InjectionManager
clazz
- The non-null class to create this object from;public <U> U createAndInitialize(Class<U> clazz)
org.glassfish.jersey.internal.inject.InjectionManager
create-class
method followed by the inject-class
method followed by the post-construct
method.
The object created is not managed by the injection manager.
createAndInitialize
in interface org.glassfish.jersey.internal.inject.InjectionManager
clazz
- The non-null class to create this object from;public org.glassfish.jersey.internal.inject.ForeignDescriptor createForeignDescriptor(org.glassfish.jersey.internal.inject.Binding binding)
org.glassfish.jersey.internal.inject.InjectionManager
ForeignDescriptor
that is specific
descriptor for the underlying DI provider.createForeignDescriptor
in interface org.glassfish.jersey.internal.inject.InjectionManager
binding
- jersey descriptor.public void inject(Object injectMe)
org.glassfish.jersey.internal.inject.InjectionManager
inject
in interface org.glassfish.jersey.internal.inject.InjectionManager
injectMe
- The object to be analyzed and injected intopublic void inject(Object injectMe, String classAnalyzer)
org.glassfish.jersey.internal.inject.InjectionManager
inject
in interface org.glassfish.jersey.internal.inject.InjectionManager
injectMe
- The object to be analyzed and injected intoCopyright © 2007-2023, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.