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

java.lang.Object
  extended by org.apache.webbeans.component.AbstractOwbBean<T>
      extended by org.apache.webbeans.component.AbstractProducerBean<T>
          extended by org.apache.webbeans.component.ProducerMethodBean<T>
All Implemented Interfaces:
javax.enterprise.context.spi.Contextual<T>, javax.enterprise.inject.spi.Bean<T>, IBeanHasParent<T>, OwbBean<T>

public class ProducerMethodBean<T>
extends AbstractProducerBean<T>

Concrete implementation of the AbstractOwbBean.

It is defined as producer method component.

Version:
$Rev: 1309109 $ $Date: 2012-04-03 21:37:56 +0200 (Di, 03 Apr 2012) $

Field Summary
protected  Method creatorMethod
          Creator method of the parent component
protected  Method disposalMethod
          Disposal method
 
Fields inherited from class org.apache.webbeans.component.AbstractProducerBean
ownerComponent
 
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
ProducerMethodBean(InjectionTargetBean<?> parent, Class<T> returnType)
          Creates a new instance.
 
Method Summary
protected  void checkNullInstance(Object instance)
          Check null control.
protected  void checkScopeType()
          Check passivation check.
protected  T createDefaultInstance(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Default producer method creation.
protected  T createInstance(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Creates the instance of the bean that has a specific implementation type.
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)
          
protected  void disposeDefault(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Default dispose method used.
 Type[] getActualTypeArguments()
          Gets actual type arguments.
 Method getCreatorMethod()
          Gets the creator method.
 Method getDisposalMethod()
          Gets the disposal method of the component.
 String getId()
          get the unique Id of the bean.
 boolean isPassivationCapable()
          True if passivation capable false otherwise.
 void setCreatorMethod(Method creatorMethod)
          Sets the method.
 void setDisposalMethod(Method disposalMethod)
          Sets the disposal method.
 String toString()
          
 
Methods inherited from class org.apache.webbeans.component.AbstractProducerBean
destroyBean, getInjectionPoints, getParent, getParentInstance, getParentInstanceFromContext, isPassivationCapable, validatePassivationDependencies
 
Methods inherited from class org.apache.webbeans.component.AbstractOwbBean
addApiType, addInjectionPoint, addQualifier, addStereoType, create, createNewInstance, destroy, destroyCreatedInstance, equals, getBeanClass, getImplQualifiers, getImplScopeType, getInjectionPoint, getLogger, getManager, getName, getOwbStereotypes, getQualifiers, getReturnType, getScope, getStereotypes, getTypes, getWebBeansContext, getWebBeansType, hashCode, isAlternative, isDependent, isEnabled, isNullable, isSerializable, isSpecializedBean, setEnabled, setImplScopeType, setName, setNullable, setSerializable, setSpecializedBean
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

creatorMethod

protected Method creatorMethod
Creator method of the parent component


disposalMethod

protected Method disposalMethod
Disposal method

Constructor Detail

ProducerMethodBean

public ProducerMethodBean(InjectionTargetBean<?> parent,
                          Class<T> returnType)
Creates a new instance.

Parameters:
parent - parent bean
returnType - producer method return type
Method Detail

getCreatorMethod

public Method getCreatorMethod()
Gets the creator method.

Returns:
producer method

setCreatorMethod

public void setCreatorMethod(Method creatorMethod)
Sets the method.

Parameters:
creatorMethod - producer method

getDisposalMethod

public Method getDisposalMethod()
Gets the disposal method of the component.

Returns:
disposal method

setDisposalMethod

public void setDisposalMethod(Method disposalMethod)
Sets the disposal method.

Parameters:
disposalMethod - disposal method of this producer method component

getId

public String getId()
Description copied from class: AbstractOwbBean
get the unique Id of the bean. This will get used as reference on passivation. Gets id of the bean.

Specified by:
getId in interface OwbBean<T>
Overrides:
getId in class AbstractOwbBean<T>
Returns:
id of the bean

getActualTypeArguments

public Type[] getActualTypeArguments()
Gets actual type arguments.

Returns:
actual type arguments

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.

Overrides:
createInstance in class AbstractProducerBean<T>
Parameters:
creationalContext - the contextual instance shall be created in
Returns:
instance of the bean

createDefaultInstance

protected T createDefaultInstance(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Default producer method creation.

Parameters:
creationalContext - creational context
Returns:
producer method instance

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 AbstractProducerBean<T>
Parameters:
instance - instance of the bean that is being destroyed
creationalContext - the contextual instance has been created in

dispose

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

Specified by:
dispose in interface IBeanHasParent<T>
Overrides:
dispose in class AbstractProducerBean<T>

disposeDefault

protected void disposeDefault(T instance,
                              javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Default dispose method used.

Parameters:
instance - bean instance

checkNullInstance

protected void checkNullInstance(Object instance)
Check null control.

Parameters:
instance - bean instance

checkScopeType

protected void checkScopeType()
Check passivation check.


isPassivationCapable

public boolean isPassivationCapable()
Description copied from interface: OwbBean
True if passivation capable false otherwise.

Specified by:
isPassivationCapable in interface OwbBean<T>
Overrides:
isPassivationCapable in class AbstractOwbBean<T>
Returns:
true if this bean is passivation capable

toString

public String toString()
Description copied from class: AbstractOwbBean

Overrides:
toString in class AbstractOwbBean<T>


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