@Contract
public interface InjectionManager
@Resource
, @EJB
, etc.) and generic
callback (PostConstruct/PreDestroy) services.
It performs the actual injection into the fields and methods of designated Java EE 5+ component instances and managed class instances. The decision as to when injection takes place is determined by the caller.
Modifier and Type | Method and Description |
---|---|
<T> T |
createManagedObject(Class<T> clazz)
Create a managed object for the given class.
|
<T> T |
createManagedObject(Class<T> clazz,
boolean invokePostConstruct)
Create a managed object for the given class.
|
void |
destroyManagedObject(Object managedObject)
Destroy a managed object that was created via createManagedObject.
|
void |
destroyManagedObject(Object managedObject,
boolean validate)
Destroy a managed object that may have been created via createManagedObject.
|
void |
inject(Class clazz,
Object instance,
JndiNameEnvironment envDescriptor,
String componentId,
boolean invokePostConstruct)
Perform injection.
|
void |
injectClass(Class clazz,
JndiNameEnvironment componentEnv)
Inject the injectable resources from the given component environment into a Class instance.
|
void |
injectClass(Class clazz,
JndiNameEnvironment componentEnv,
boolean invokePostConstruct)
Inject the injectable resources from the given component environment into a Class instance.
|
void |
injectClass(Class clazz,
String componentId,
boolean invokePostConstruct)
Inject the injectable resources from the given component id into a Class instance.
|
void |
injectInstance(Object instance)
Inject the given object instance with the resources from its component environment.
|
void |
injectInstance(Object instance,
boolean invokePostConstruct)
Inject the given object instance with the resources from its component environment.
|
void |
injectInstance(Object instance,
JndiNameEnvironment componentEnv)
Inject the injectable resources from the given component environment into an object instance.
|
void |
injectInstance(Object instance,
JndiNameEnvironment componentEnv,
boolean invokePostConstruct)
Inject the injectable resources from the given component environment into an object instance.
|
void |
injectInstance(Object instance,
String componentId,
boolean invokePostConstruct)
Inject the injectable resources for the given component id into an object instance.
|
void |
invokeClassPreDestroy(Class clazz,
JndiNameEnvironment componentEnv)
Invoke any static @PreDestroy methods defined on the class (and super-classes).
|
void |
invokeInstancePostConstruct(Object instance,
JndiNameEnvironment componentEnv)
Invoke any @PostConstruct methods defined on the instance's class (and super-classes).
|
void |
invokeInstancePreDestroy(Object instance)
Invoke any @PreDestroy methods defined on the instance's class (and super-classes).
|
void |
invokeInstancePreDestroy(Object instance,
boolean validate)
Invoke any @PreDestroy methods defined on the instance's class (and super-classes).
|
void |
invokeInstancePreDestroy(Object instance,
JndiNameEnvironment componentEnv)
Invoke any @PreDestroy methods defined on the instance's class (and super-classes).
|
void injectInstance(Object instance) throws InjectionException
InjectionException
- Thrown if an error occurs during injectionvoid injectInstance(Object instance, boolean invokePostConstruct) throws InjectionException
InjectionException
- Thrown if an error occurs during injectionvoid injectInstance(Object instance, JndiNameEnvironment componentEnv) throws InjectionException
InjectionException
- Thrown if an error occurs during injectionvoid injectInstance(Object instance, JndiNameEnvironment componentEnv, boolean invokePostConstruct) throws InjectionException
invokePostConstruct
- if true, invoke any @PostConstruct methods on the instance's class(and super-classes) after injection.InjectionException
- Thrown if an error occurs during injectionvoid injectInstance(Object instance, String componentId, boolean invokePostConstruct) throws InjectionException
invokePostConstruct
- if true, invoke any @PostConstruct methods on the instance's class(and super-classes) after injection.InjectionException
- Thrown if an error occurs during injectionvoid injectClass(Class clazz, String componentId, boolean invokePostConstruct) throws InjectionException
invokePostConstruct
- if true, invoke any @PostConstruct methods on the class(and super-classes) after injection.InjectionException
- Thrown if an error occurs during injectionvoid injectClass(Class clazz, JndiNameEnvironment componentEnv) throws InjectionException
InjectionException
- Thrown if an error occurs during injectionvoid injectClass(Class clazz, JndiNameEnvironment componentEnv, boolean invokePostConstruct) throws InjectionException
invokePostConstruct
- if true, invoke any @PostConstruct methods on the class(and super-classes) after injection.InjectionException
- Thrown if an error occurs during injectionvoid invokeInstancePreDestroy(Object instance) throws InjectionException
InjectionException
- Thrown if an error occursvoid invokeInstancePreDestroy(Object instance, boolean validate) throws InjectionException
validate
- if false, do nothing if the instance is not registeredInjectionException
- Thrown if an error occursvoid invokeInstancePreDestroy(Object instance, JndiNameEnvironment componentEnv) throws InjectionException
InjectionException
- Thrown if an error occursvoid invokeInstancePostConstruct(Object instance, JndiNameEnvironment componentEnv) throws InjectionException
InjectionException
- Thrown if an error occursvoid invokeClassPreDestroy(Class clazz, JndiNameEnvironment componentEnv) throws InjectionException
InjectionException
- Thrown if an error occurs<T> T createManagedObject(Class<T> clazz) throws InjectionException
clazz
- Class to be instantiatedInjectionException
<T> T createManagedObject(Class<T> clazz, boolean invokePostConstruct) throws InjectionException
clazz
- Class to be instantiatedinvokePostConstruct
- if true, invoke any @PostConstruct methods on the instance's class(and super-classes) after injection.InjectionException
void destroyManagedObject(Object managedObject) throws InjectionException
managedObject
- InjectionException
void destroyManagedObject(Object managedObject, boolean validate) throws InjectionException
managedObject
- validate
- if false the object might not been created by createManagedObject() callInjectionException
void inject(Class clazz, Object instance, JndiNameEnvironment envDescriptor, String componentId, boolean invokePostConstruct) throws InjectionException
clazz
- The class of the instance to perform injection. This is needed b/c of static injection.instance
- The instance on which to perform injection.envDescriptor
- The descriptor containing the injection information.componentId
- The id of the component in whose jndi environment injection actually occurs. Null indicates the current
jndi environment.invokePostConstruct
- if true, invoke any @PostConstruct methodsInjectionException
Copyright © 2019. All rights reserved.