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: 1413276 $ $Date: 2012-11-24 23:10:20 +0100 (Sa, 24 Nov 2012) $

Field Summary
protected  InjectionTargetBean<?> ownerComponent
          Owner of the producer field component
 
Fields inherited from class org.apache.webbeans.component.AbstractOwbBean
apiTypes, enabled, implQualifiers, injectionPoints, logger, name, nullable, passivatingId, returnType, scopeClass, serializable, specializedBean, stereoTypeClasses, stereoTypes, webBeansContext, 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.
 void dispose(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          
 boolean equals(Object object)
           
 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)
           
 int hashCode()
           
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, destroyInstance, getBeanClass, getId, getInjectionPoint, getInjectionPoints, getLogger, getManager, getName, getOwbStereotypes, getQualifiers, getReturnType, getScope, getStereotypes, getTypes, getWebBeansContext, getWebBeansType, 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)

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>

hashCode

public int hashCode()
Overrides:
hashCode in class AbstractOwbBean<T>

equals

public boolean equals(Object object)
Overrides:
equals in class AbstractOwbBean<T>


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