Package org.jboss.weld.contexts
Class CreationalContextImpl<T>
- java.lang.Object
-
- org.jboss.weld.contexts.CreationalContextImpl<T>
-
- All Implemented Interfaces:
Serializable,CreationalContext<T>,org.jboss.weld.construction.api.WeldCreationalContext<T>,WeldCreationalContext<T>
public class CreationalContextImpl<T> extends Object implements CreationalContext<T>, WeldCreationalContext<T>, Serializable
- Author:
- Pete Muir, Ales Justin, Jozef Hartinger
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CreationalContextImpl(Contextual<T> contextual)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDependentInstance(ContextualInstance<?> contextualInstance)voidaddDependentResourceReference(org.jboss.weld.injection.spi.ResourceReference<?> resourceReference)Register aResourceReferenceas a dependency.booleancontainsIncompleteInstance(Contextual<?> bean)booleandestroyDependentInstance(T instance)Destroys dependent instanceList<org.jboss.weld.construction.api.AroundConstructCallback<T>>getAroundConstructCallbacks()InterceptionContextgetAroundConstructInterceptionContext()Contextual<T>getContextual()<S> CreationalContextImpl<S>getCreationalContext(Contextual<S> contextual)List<ContextualInstance<?>>getDependentInstances()Returns an unmodifiable list of dependent instances.<S> SgetIncompleteInstance(Contextual<S> bean)CreationalContextImpl<?>getParentCreationalContext()<S> CreationalContextImpl<S>getProducerReceiverCreationalContext(Contextual<S> contextual)The returnedCreationalContextshares nothing but incomplete instances.booleanisConstructorInterceptionSuppressed()voidpush(T incompleteInstance)Registers an incompletely initialized contextual instance the with the container.voidregisterAroundConstructCallback(org.jboss.weld.construction.api.AroundConstructCallback<T> callback)voidrelease()Destroys all dependent objects of the instance which is being destroyed, by passing each dependent object toContextual.destroy(Object, CreationalContext).voidrelease(Contextual<T> contextual, T instance)voidsetAroundConstructInterceptionContext(InterceptionContext aroundConstructInterceptionContext)voidsetConstructorInterceptionSuppressed(boolean value)protected ObjectwriteReplace()
-
-
-
Constructor Detail
-
CreationalContextImpl
public CreationalContextImpl(Contextual<T> contextual)
-
-
Method Detail
-
push
public void push(T incompleteInstance)
Description copied from interface:CreationalContextRegisters an incompletely initialized contextual instance the with the container. A contextual instance is considered incompletely initialized until it is returned byContextual.create(CreationalContext).- Specified by:
pushin interfaceCreationalContext<T>- Parameters:
incompleteInstance- the incompletely initialized instance
-
getCreationalContext
public <S> CreationalContextImpl<S> getCreationalContext(Contextual<S> contextual)
- Specified by:
getCreationalContextin interfaceWeldCreationalContext<T>
-
getProducerReceiverCreationalContext
public <S> CreationalContextImpl<S> getProducerReceiverCreationalContext(Contextual<S> contextual)
Description copied from interface:WeldCreationalContextThe returnedCreationalContextshares nothing but incomplete instances.- Specified by:
getProducerReceiverCreationalContextin interfaceWeldCreationalContext<T>- Returns:
- the
CreationalContextfor a producer reciever
-
getIncompleteInstance
public <S> S getIncompleteInstance(Contextual<S> bean)
- Specified by:
getIncompleteInstancein interfaceWeldCreationalContext<T>
-
containsIncompleteInstance
public boolean containsIncompleteInstance(Contextual<?> bean)
-
addDependentInstance
public void addDependentInstance(ContextualInstance<?> contextualInstance)
- Specified by:
addDependentInstancein interfaceWeldCreationalContext<T>
-
release
public void release()
Description copied from interface:CreationalContextDestroys all dependent objects of the instance which is being destroyed, by passing each dependent object toContextual.destroy(Object, CreationalContext).- Specified by:
releasein interfaceCreationalContext<T>- Specified by:
releasein interfaceWeldCreationalContext<T>
-
release
public void release(Contextual<T> contextual, T instance)
-
getParentCreationalContext
public CreationalContextImpl<?> getParentCreationalContext()
- Specified by:
getParentCreationalContextin interfaceWeldCreationalContext<T>- Returns:
- the parent
CreationalContextor null if there isn't any parent.
-
getDependentInstances
public List<ContextualInstance<?>> getDependentInstances()
Returns an unmodifiable list of dependent instances.- Specified by:
getDependentInstancesin interfaceWeldCreationalContext<T>
-
writeReplace
protected Object writeReplace() throws ObjectStreamException
- Throws:
ObjectStreamException
-
addDependentResourceReference
public void addDependentResourceReference(org.jboss.weld.injection.spi.ResourceReference<?> resourceReference)
Register aResourceReferenceas a dependency.ResourceReference.release()will be called on everyResourceReferenceonce thisCreationalContextinstance is released.- Specified by:
addDependentResourceReferencein interfaceWeldCreationalContext<T>
-
destroyDependentInstance
public boolean destroyDependentInstance(T instance)
Destroys dependent instance- Specified by:
destroyDependentInstancein interfaceWeldCreationalContext<T>- Parameters:
instance-- Returns:
- true if the instance was destroyed, false otherwise
-
getContextual
public Contextual<T> getContextual()
- Specified by:
getContextualin interfaceWeldCreationalContext<T>- Returns:
- the
Contextualfor which thisCreationalContextis created.
-
getAroundConstructCallbacks
public List<org.jboss.weld.construction.api.AroundConstructCallback<T>> getAroundConstructCallbacks()
-
setConstructorInterceptionSuppressed
public void setConstructorInterceptionSuppressed(boolean value)
- Specified by:
setConstructorInterceptionSuppressedin interfaceorg.jboss.weld.construction.api.WeldCreationalContext<T>
-
isConstructorInterceptionSuppressed
public boolean isConstructorInterceptionSuppressed()
- Specified by:
isConstructorInterceptionSuppressedin interfaceorg.jboss.weld.construction.api.WeldCreationalContext<T>
-
registerAroundConstructCallback
public void registerAroundConstructCallback(org.jboss.weld.construction.api.AroundConstructCallback<T> callback)
- Specified by:
registerAroundConstructCallbackin interfaceorg.jboss.weld.construction.api.WeldCreationalContext<T>
-
getAroundConstructInterceptionContext
public InterceptionContext getAroundConstructInterceptionContext()
- Returns:
- the interception context used for Weld-managed AroundConstruct interceptors or
nullif no such interceptors were applied
-
setAroundConstructInterceptionContext
public void setAroundConstructInterceptionContext(InterceptionContext aroundConstructInterceptionContext)
-
-