org.apache.webbeans.component
Class AbstractProducerBean<T>

java.lang.Object
  extended by org.apache.webbeans.component.AbstractOwbBean<T>
      extended by org.apache.webbeans.component.AbstractProducerBean<T>
Type Parameters:
T - bean type info
All Implemented Interfaces:
javax.enterprise.context.spi.Contextual<T>, javax.enterprise.inject.spi.Bean<T>, IBeanHasParent<T>, OwbBean<T>
Direct Known Subclasses:
ProducerFieldBean, ProducerMethodBean

public abstract class AbstractProducerBean<T>
extends AbstractOwbBean<T>
implements IBeanHasParent<T>

Abstract class for producer components.

Version:
$Rev: 1182780 $ $Date: 2011-10-13 13:11:03 +0200 (Do, 13 Okt 2011) $

Field Summary
protected  InjectionTargetBean<?> ownerComponent
          Owner of the producer field component
 
Fields inherited from class org.apache.webbeans.component.AbstractOwbBean
apiTypes, enabled, implQualifiers, implScopeType, injectionPoints, name, nullable, passivatingId, returnType, scopeClass, serializable, specializedBean, stereoTypeClasses, stereoTypes, webBeansType
 
Constructor Summary
protected AbstractProducerBean(WebBeansType type, Class<T> returnType, InjectionTargetBean<?> ownerComponent)
          Create a new instance.
 
Method Summary
protected  T createInstance(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Creates the instance of the bean that has a specific implementation type.
protected
<K> void
destroyBean(javax.enterprise.inject.spi.Bean<?> bean, Object instance, javax.enterprise.context.spi.CreationalContext<?> creationalContext)
          Destroys bean.
protected  void destroyInstance(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Destroy the instance of the bean.
 void dispose(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          
 Set<javax.enterprise.inject.spi.InjectionPoint> getInjectionPoints()
          
 InjectionTargetBean<?> getParent()
          
protected  Object getParentInstance(javax.enterprise.context.spi.CreationalContext<?> creationalContext)
          Returns producer bean's owner bean instance.
protected  Object getParentInstanceFromContext(javax.enterprise.context.spi.CreationalContext<?> creationalContext)
           
protected  boolean isPassivationCapable(Class<?> returnType, Integer modifiers)
           
 void validatePassivationDependencies()
          If bean is passivation capable, it validate all of its dependencies.
 
Methods inherited from class org.apache.webbeans.component.AbstractOwbBean
addApiType, addInjectionPoint, addQualifier, addStereoType, create, createNewInstance, destroy, destroyCreatedInstance, equals, getBeanClass, getId, getImplQualifiers, getImplScopeType, getInjectionPoint, getLogger, getManager, getName, getOwbStereotypes, getQualifiers, getReturnType, getScope, getStereotypes, getTypes, getWebBeansContext, getWebBeansType, hashCode, isAlternative, isDependent, isEnabled, isNullable, isPassivationCapable, isSerializable, isSpecializedBean, setEnabled, setImplScopeType, setName, setNullable, setSerializable, setSpecializedBean, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ownerComponent

protected InjectionTargetBean<?> ownerComponent
Owner of the producer field component

Constructor Detail

AbstractProducerBean

protected AbstractProducerBean(WebBeansType type,
                               Class<T> returnType,
                               InjectionTargetBean<?> ownerComponent)
Create a new instance.

Parameters:
type - webbeans typr
returnType - bean type info
ownerComponent - owner bean
Method Detail

getParent

public InjectionTargetBean<?> getParent()

Specified by:
getParent in interface IBeanHasParent<T>

dispose

public void dispose(T instance,
                    javax.enterprise.context.spi.CreationalContext<T> creationalContext)

Specified by:
dispose in interface IBeanHasParent<T>

createInstance

protected T createInstance(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Creates the instance of the bean that has a specific implementation type. Each subclass must define its own create mechanism.

Specified by:
createInstance in class AbstractOwbBean<T>
Parameters:
creationalContext - the contextual instance shall be created in
Returns:
instance of the bean

destroyBean

protected <K> void destroyBean(javax.enterprise.inject.spi.Bean<?> bean,
                               Object instance,
                               javax.enterprise.context.spi.CreationalContext<?> creationalContext)
Destroys bean.

Type Parameters:
K - bean type info
Parameters:
bean - bean info
instance - bean instance

getParentInstance

protected Object getParentInstance(javax.enterprise.context.spi.CreationalContext<?> creationalContext)
Returns producer bean's owner bean instance.

Returns:
owner bean instance

getParentInstanceFromContext

protected Object getParentInstanceFromContext(javax.enterprise.context.spi.CreationalContext<?> creationalContext)

destroyInstance

protected void destroyInstance(T instance,
                               javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Destroy the instance of the bean. Each subclass must define its own destroy mechanism.

Overrides:
destroyInstance in class AbstractOwbBean<T>
Parameters:
instance - instance of the bean that is being destroyed
creationalContext - the contextual instance has been created in

getInjectionPoints

public Set<javax.enterprise.inject.spi.InjectionPoint> getInjectionPoints()

Specified by:
getInjectionPoints in interface javax.enterprise.inject.spi.Bean<T>
Overrides:
getInjectionPoints in class AbstractOwbBean<T>

isPassivationCapable

protected boolean isPassivationCapable(Class<?> returnType,
                                       Integer modifiers)

validatePassivationDependencies

public void validatePassivationDependencies()
Description copied from interface: OwbBean
If bean is passivation capable, it validate all of its dependencies.

Specified by:
validatePassivationDependencies in interface OwbBean<T>
Overrides:
validatePassivationDependencies in class AbstractOwbBean<T>


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.