public interface CreationalContext<T>
The CreationalContext
holds incomplete Bean instances and
references to allDependent
scoped
contextual instances injected into a NormalScope
d
bean.
E.g. consider we create a Contextual Instance of a
SessionScoped
UserInformation
bean which has a dependent injection point
(e.g. a field private @Inject Helper helper;
)
In that case the CreationalContext of the UserInformation
instance
will contain the information about the helper
instance.
This is needed to properly destroy the helper
once the
UserInformation
gets destroyed. In our example this will
happen at the end of the Session.
Attention: If you create a Dependent
instance
manually using
BeanManager.getReference(javax.enterprise.inject.spi.Bean, java.lang.reflect.Type, CreationalContext)
then you must store away the CreationalContext. You will need it for properly destroying the created instance
via Contextual.destroy(Object, CreationalContext)
.
This is not needed for NormalScope
d beans as they
maintain their lifecycle themself!
Modifier and Type | Method and Description |
---|---|
void |
push(T incompleteInstance)
Puts new incomplete instance into the creational context.
|
void |
release()
Destorys all dependent objects of the instance
that is being destroyed.
|
void push(T incompleteInstance)
incompleteInstance
- incomplete webbeans instancevoid release()
Copyright © 2019. All rights reserved.