org.jboss.webbeans.bean
Class AbstractProducerBean<T,S extends java.lang.reflect.Member>

java.lang.Object
  extended by javax.inject.manager.Bean<T>
      extended by org.jboss.webbeans.bean.RIBean<T>
          extended by org.jboss.webbeans.bean.AbstractBean<T,S>
              extended by org.jboss.webbeans.bean.AbstractProducerBean<T,S>
Type Parameters:
T -
S -
All Implemented Interfaces:
Contextual<T>
Direct Known Subclasses:
ProducerFieldBean, ProducerMethodBean

public abstract class AbstractProducerBean<T,S extends java.lang.reflect.Member>
extends AbstractBean<T,S>

The implicit producer bean

Author:
Gavin King

Field Summary
protected  AbstractClassBean<?> declaringBean
           
 
Fields inherited from class org.jboss.webbeans.bean.AbstractBean
_serializable, bindings, dependentInstancesStore, deploymentType, injectionPoints, manager, name, scopeType, type, types
 
Constructor Summary
AbstractProducerBean(AbstractClassBean<?> declaringBean, ManagerImpl manager)
          Constructor
 
Method Summary
protected  void checkProducerReturnType()
          Validates the producer method
protected  void checkReturnValue(T instance)
          Validates the return value
 T create(CreationalContext<T> creationalContext)
          Creates an instance of the bean
 void destroy(T instance)
          Destroys an instance of the contexual type
protected abstract  AnnotatedMember<T,S> getAnnotatedItem()
          Returns the annotated time the bean represents
protected  java.lang.reflect.Type getDeclaredBeanType()
          Gets the declared bean type
 AbstractClassBean<?> getDeclaringBean()
          Returns the declaring bean
protected  java.lang.Class<? extends java.lang.annotation.Annotation> getDefaultDeploymentType()
          Gets the deployment types
protected  java.lang.Object getReceiver(CreationalContext<?> creationalContext)
          Gets the receiver of the product
protected  void initDeploymentType()
          Initializes the deployment types
 void initialize(BeanDeployerEnvironment environment)
          Initializes the bean and its metadata
protected  void initScopeType()
          Initializes the scope type
protected  void initSerializable()
           
protected  void initType()
          Initializes the type
protected  void initTypes()
          Initializes the API types
protected abstract  T produceInstance(CreationalContext<T> creationalContext)
           
 java.lang.String toString()
          Gets a string representation
 
Methods inherited from class org.jboss.webbeans.bean.AbstractBean
checkDeploymentType, checkRequiredTypesImplemented, getBindings, getDefaultName, getDeploymentType, getDeploymentType, getInjectionPoints, getMergedStereotypes, getName, getScopeType, getSpecializedBean, getType, getTypes, initBindings, initDefaultBindings, initDeploymentTypeFromStereotype, initName, initPrimitive, initProxyable, initScopeTypeFromStereotype, isAssignableFrom, isDependent, isInitialized, isNullable, isPrimitive, isProxyable, isSerializable, isSpecializing, postSpecialize, preSpecialize, specialize
 
Methods inherited from class org.jboss.webbeans.bean.RIBean
createId, equals, getId, getManager, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

declaringBean

protected AbstractClassBean<?> declaringBean
Constructor Detail

AbstractProducerBean

public AbstractProducerBean(AbstractClassBean<?> declaringBean,
                            ManagerImpl manager)
Constructor

Parameters:
declaringBean - The declaring bean
manager - The Web Beans manager
Method Detail

getAnnotatedItem

protected abstract AnnotatedMember<T,S> getAnnotatedItem()
Description copied from class: AbstractBean
Returns the annotated time the bean represents

Specified by:
getAnnotatedItem in class AbstractBean<T,S extends java.lang.reflect.Member>
Returns:
The annotated item

getDefaultDeploymentType

protected java.lang.Class<? extends java.lang.annotation.Annotation> getDefaultDeploymentType()
Gets the deployment types

Specified by:
getDefaultDeploymentType in class AbstractBean<T,S extends java.lang.reflect.Member>
Returns:
The deployment types of the declaring bean

initTypes

protected void initTypes()
Initializes the API types

Overrides:
initTypes in class AbstractBean<T,S extends java.lang.reflect.Member>

initType

protected void initType()
Initializes the type


getDeclaredBeanType

protected java.lang.reflect.Type getDeclaredBeanType()
Gets the declared bean type

Returns:
The bean type

getDeclaringBean

public AbstractClassBean<?> getDeclaringBean()
Returns the declaring bean

Returns:
The bean representation

checkProducerReturnType

protected void checkProducerReturnType()
Validates the producer method


initialize

public void initialize(BeanDeployerEnvironment environment)
Initializes the bean and its metadata

Overrides:
initialize in class AbstractBean<T,S extends java.lang.reflect.Member>

checkReturnValue

protected void checkReturnValue(T instance)
Validates the return value

Parameters:
instance - The instance to validate

initScopeType

protected void initScopeType()
Description copied from class: AbstractBean
Initializes the scope type

Specified by:
initScopeType in class AbstractBean<T,S extends java.lang.reflect.Member>

initDeploymentType

protected void initDeploymentType()
Description copied from class: AbstractBean
Initializes the deployment types

Specified by:
initDeploymentType in class AbstractBean<T,S extends java.lang.reflect.Member>

initSerializable

protected void initSerializable()
Overrides:
initSerializable in class AbstractBean<T,S extends java.lang.reflect.Member>

getReceiver

protected java.lang.Object getReceiver(CreationalContext<?> creationalContext)
Gets the receiver of the product

Returns:
The receiver

create

public T create(CreationalContext<T> creationalContext)
Creates an instance of the bean

Parameters:
creationalContext - the creational context in which incompletely initialized contexts may be placed
Returns:
the contextual instance

destroy

public void destroy(T instance)
Description copied from interface: Contextual
Destroys an instance of the contexual type

Parameters:
instance - the insance to destroy

produceInstance

protected abstract T produceInstance(CreationalContext<T> creationalContext)

toString

public java.lang.String toString()
Gets a string representation

Overrides:
toString in class AbstractBean<T,S extends java.lang.reflect.Member>
Returns:
The string representation


Copyright © 2011. All Rights Reserved.