public class CdiSeInjectionManager extends Object implements InjectionManager
InjectionManager that starts CDI SE container, scans all users bean according to beans.xml file and
register Jersey's internal beans using SeBeanRegisterExtension extension.| Constructor and Description |
|---|
CdiSeInjectionManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
completeRegistration()
Completes
InjectionManager and the underlying DI provider. |
<T> T |
create(Class<T> createMe)
Creates an object with the given class.
|
<T> T |
createAndInitialize(Class<T> createMe)
Creates, injects and post-constructs an object with the given class.
|
ForeignDescriptor |
createForeignDescriptor(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 contractOrImpl)
Gets all services from this injection manager that implement this contract or have this implementation.
|
<T> List<ServiceHolder<T>> |
getAllServiceHolders(Class<T> contractOrImpl,
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. |
javax.enterprise.inject.spi.BeanManager |
getBeanManager() |
protected AbstractBinder |
getBindings() |
javax.enterprise.inject.se.SeContainer |
getContainer() |
<T> T |
getInstance(Class<T> contractOrImpl)
Gets the best service from this injection manager that implements this contract or has this implementation.
|
<T> T |
getInstance(Class<T> contractOrImpl,
Annotation... qualifiers)
Gets the best service from this injection manager that implements this contract or has this implementation.
|
<T> T |
getInstance(Class<T> contractOrImpl,
String classAnalyzer)
Gets the best service from this injection manager that implements this contract or has this implementation.
|
Object |
getInstance(ForeignDescriptor foreignDescriptor)
Gets the service instance according to
ForeignDescriptor which is specific to the underlying DI provider. |
<T> T |
getInstance(Type contractOrImpl)
Gets the best service from this injection manager that implements this contract or has this implementation.
|
void |
inject(Object instance)
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(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(Iterable<Binding> bindings)
Registers a collection of beans represented using fields in the provided descriptors.
|
void |
register(Object provider)
Registers a provider.
|
void |
setBeanManager(javax.enterprise.inject.spi.BeanManager beanManager) |
void |
setContainer(javax.enterprise.inject.se.SeContainer container) |
void |
shutdown()
Shuts down the entire
InjectionManager and the underlying DI provider. |
public void register(Binding binding)
InjectionManagerInjectionManager is able to register a bean
represented by a class or direct instance.register in interface InjectionManagerbinding - one descriptor.ClassBinding,
InstanceBinding,
SupplierClassBinding,
SupplierInstanceBindingpublic void register(Iterable<Binding> bindings)
InjectionManagerInjectionManager is able to
register a bean represented by a class or direct instance.register in interface InjectionManagerbindings - collection of descriptors.ClassBinding,
InstanceBinding,
SupplierClassBinding,
SupplierInstanceBindingpublic void register(Binder binder)
InjectionManagerBinder. 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.register in interface InjectionManagerbinder - collection of descriptors.ClassBinding,
InstanceBinding,
SupplierClassBinding,
SupplierInstanceBindingpublic void register(Object provider) throws IllegalArgumentException
InjectionManagerInjectionManager 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.register in interface InjectionManagerprovider - object that can be registered in InjectionManager.IllegalArgumentException - provider cannot be registered.public boolean isRegistrable(Class<?> clazz)
InjectionManagerclazz can be registered by the implementation of the InjectionManager.isRegistrable in interface InjectionManagerclazz - type that is tested whether is registrable by the implementation of InjectionManager.true if the InjectionManager is able to register this type.public <T> T createAndInitialize(Class<T> createMe)
InjectionManagercreate-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 InjectionManagercreateMe - The non-null class to create this object from;public <T> T create(Class<T> createMe)
InjectionManagerThe object created is not managed by the injection manager.
create in interface InjectionManagercreateMe - The non-null class to create this object from;public <T> List<ServiceHolder<T>> getAllServiceHolders(Class<T> contractOrImpl, Annotation... qualifiers)
InjectionManagerServiceHolder.getAllServiceHolders in interface InjectionManagerT - Instance type.contractOrImpl - 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> contractOrImpl, Annotation... qualifiers)
InjectionManager
Use this method only if other information is not needed otherwise use, otherwise use
InjectionManager.getAllServiceHolders(Class, Annotation...).
getInstance in interface InjectionManagerT - Instance type.contractOrImpl - 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> contractOrImpl)
InjectionManager
Use this method only if other information is not needed otherwise use, otherwise use
InjectionManager.getAllServiceHolders(Class, Annotation...).
getInstance in interface InjectionManagerT - Instance type.contractOrImpl - May not be null, and is the contract or concrete implementation to get the best instance of.public <T> T getInstance(Type contractOrImpl)
InjectionManager
Use this method only if other information is not needed otherwise use, otherwise use
InjectionManager.getAllServiceHolders(Class, Annotation...).
getInstance in interface InjectionManagerT - Instance type.contractOrImpl - May not be null, and is the contract or concrete implementation to get the best instance of.public Object getInstance(ForeignDescriptor foreignDescriptor)
InjectionManagerForeignDescriptor which is specific to the underlying DI provider.getInstance in interface InjectionManagerforeignDescriptor - DI specific descriptor.public ForeignDescriptor createForeignDescriptor(Binding binding)
InjectionManagerForeignDescriptor that is specific
descriptor for the underlying DI provider.createForeignDescriptor in interface InjectionManagerbinding - jersey descriptor.public <T> List<T> getAllInstances(Type contractOrImpl)
InjectionManager
Use this method only if other information is not needed otherwise use, otherwise use
InjectionManager.getAllServiceHolders(Class, Annotation...).
getAllInstances in interface InjectionManagerT - Instance type.contractOrImpl - May not be null, and is the contract or concrete implementation to get the best instance of.public void inject(Object instance)
InjectionManagerinject in interface InjectionManagerinstance - The object to be analyzed and injected intopublic void preDestroy(Object preDestroyMe)
InjectionManagerpreDestroy in interface InjectionManagerpreDestroyMe - The object to preDestroypublic void completeRegistration()
throws IllegalStateException
InjectionManagerInjectionManager 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).completeRegistration in interface InjectionManagerIllegalStateExceptionprotected AbstractBinder getBindings()
public javax.enterprise.inject.se.SeContainer getContainer()
public void setContainer(javax.enterprise.inject.se.SeContainer container)
public javax.enterprise.inject.spi.BeanManager getBeanManager()
public void setBeanManager(javax.enterprise.inject.spi.BeanManager beanManager)
public void shutdown()
InjectionManagerInjectionManager and the underlying DI provider.
Shutdown phase is dedicated to make some final cleaning steps regarding underlying DI provider.
shutdown in interface InjectionManagerpublic boolean isShutdown()
InjectionManagerisShutdown in interface InjectionManagerInjectionManager has been shutdown.public void inject(Object injectMe, String classAnalyzer)
InjectionManagerinject in interface InjectionManagerinjectMe - The object to be analyzed and injected intopublic <T> T getInstance(Class<T> contractOrImpl, String classAnalyzer)
InjectionManager
Use this method only if other information is not needed otherwise use, otherwise use
InjectionManager.getAllServiceHolders(Class, Annotation...).
getInstance in interface InjectionManagerT - Instance type.contractOrImpl - May not be null, and is the contract or concrete implementation to get the best instance of.classAnalyzer - -------Copyright © 2007-2024,Oracleand/or its affiliates.All Rights Reserved. Use is subject to license terms.