Package org.jboss.weld.bean
Class AbstractProducerBean<X,T,S extends Member>
- java.lang.Object
-
- org.jboss.weld.util.bean.ForwardingBeanAttributes<T>
-
- org.jboss.weld.bean.CommonBean<T>
-
- org.jboss.weld.bean.RIBean<T>
-
- org.jboss.weld.bean.AbstractBean<T,S>
-
- org.jboss.weld.bean.AbstractProducerBean<X,T,S>
-
- Type Parameters:
X-T-S-
- All Implemented Interfaces:
Contextual<T>,Bean<T>,BeanAttributes<T>,PassivationCapable,WeldBean<T>
- Direct Known Subclasses:
ProducerField,ProducerMethod
public abstract class AbstractProducerBean<X,T,S extends Member> extends AbstractBean<T,S>
The implicit producer bean- Author:
- Gavin King, David Allen, Jozef Hartinger
-
-
Field Summary
-
Fields inherited from class org.jboss.weld.bean.AbstractBean
type
-
Fields inherited from class org.jboss.weld.bean.RIBean
beanManager
-
-
Constructor Summary
Constructors Constructor Description AbstractProducerBean(BeanAttributes<T> attributes, org.jboss.weld.serialization.spi.BeanIdentifier identifier, AbstractClassBean<X> declaringBean, BeanManagerImpl beanManager, org.jboss.weld.bootstrap.api.ServiceRegistry services)Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected TcheckReturnValue(T instance)Validates the return valueprotected voidcheckType()Tcreate(CreationalContext<T> creationalContext)Creates an instance of the beanvoiddestroy(T instance, CreationalContext<T> creationalContext)Destroy an instance of the contextual type.abstract AnnotatedMember<? super X>getAnnotated()Returns the annotated item the bean representsClass<?>getBeanClass()The bean class of the managed bean or session bean or of the bean that declares the producer method or field.AbstractClassBean<X>getDeclaringBean()Returns the declaring beanabstract EnhancedAnnotatedMember<T,?,S>getEnhancedAnnotated()Returns the weld-enhanced annotated item the bean represents.Set<InjectionPoint>getInjectionPoints()Obtains theInjectionPointobjects representing injection points of the bean, that will be validated by the container at initialization time.protected voidinitType()Initializes the typevoidinternalInitialize(BeanDeployerEnvironment environment)Initializes the bean and its metadatabooleanisPassivationCapableBean()booleanisPassivationCapableDependency()protected booleanisTypeSerializable(Object instance)-
Methods inherited from class org.jboss.weld.bean.AbstractBean
checkSpecialization, getProducer, getSpecializedBeans, getType, initializeAfterBeanDiscovery, isDependent, isIgnoreFinalMethods, isProxyRequired, isSpecializing, postSpecialize, preInitialize, preSpecialize, setIgnoreFinalMethods, setProducer, specialize
-
Methods inherited from class org.jboss.weld.bean.RIBean
cleanupAfterBoot, getBeanManager, getContextualInstanceStrategy, getQualifierInstances, initialize, isNormalScoped, isProxyable, setAttributes
-
Methods inherited from class org.jboss.weld.bean.CommonBean
attributes, equals, getId, getIdentifier, hashCode, isNullable, toString, unwrap
-
Methods inherited from class org.jboss.weld.util.bean.ForwardingBeanAttributes
getName, getQualifiers, getScope, getStereotypes, getTypes, isAlternative
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javax.enterprise.inject.spi.BeanAttributes
getName, getQualifiers, getScope, getStereotypes, getTypes, isAlternative
-
Methods inherited from interface javax.enterprise.inject.spi.PassivationCapable
getId
-
Methods inherited from interface org.jboss.weld.bean.WeldBean
getPriority
-
-
-
-
Constructor Detail
-
AbstractProducerBean
public AbstractProducerBean(BeanAttributes<T> attributes, org.jboss.weld.serialization.spi.BeanIdentifier identifier, AbstractClassBean<X> declaringBean, BeanManagerImpl beanManager, org.jboss.weld.bootstrap.api.ServiceRegistry services)
Constructor- Parameters:
declaringBean- The declaring beanbeanManager- The Bean manager
-
-
Method Detail
-
getBeanClass
public Class<?> getBeanClass()
Description copied from interface:BeanThe bean class of the managed bean or session bean or of the bean that declares the producer method or field.- Specified by:
getBeanClassin interfaceBean<X>- Overrides:
getBeanClassin classRIBean<T>- Returns:
- the bean class
-
initType
protected void initType()
Initializes the type
-
internalInitialize
public void internalInitialize(BeanDeployerEnvironment environment)
Initializes the bean and its metadata- Overrides:
internalInitializein classAbstractBean<T,S extends Member>
-
isPassivationCapableBean
public boolean isPassivationCapableBean()
- Specified by:
isPassivationCapableBeanin classRIBean<T>
-
isPassivationCapableDependency
public boolean isPassivationCapableDependency()
- Specified by:
isPassivationCapableDependencyin classRIBean<T>
-
getInjectionPoints
public Set<InjectionPoint> getInjectionPoints()
Description copied from interface:BeanObtains theInjectionPointobjects representing injection points of the bean, that will be validated by the container at initialization time.- Returns:
- the set of injection points of the bean
-
checkReturnValue
protected T checkReturnValue(T instance)
Validates the return value- Parameters:
instance- The instance to validate
-
checkType
protected void checkType()
- Specified by:
checkTypein classAbstractBean<T,S extends Member>
-
isTypeSerializable
protected boolean isTypeSerializable(Object instance)
-
create
public T create(CreationalContext<T> creationalContext)
Creates an instance of the bean- Parameters:
creationalContext- the context in which this instance is being created- Returns:
- the contextual instance
-
destroy
public void destroy(T instance, CreationalContext<T> creationalContext)
Description copied from interface:ContextualDestroy an instance of the contextual type. Implementations should callCreationalContext.release()to allow the container to destroy dependent objects of the contextual instance.
-
getDeclaringBean
public AbstractClassBean<X> getDeclaringBean()
Returns the declaring bean- Returns:
- The bean representation
-
getAnnotated
public abstract AnnotatedMember<? super X> getAnnotated()
Description copied from class:AbstractBeanReturns the annotated item the bean represents- Specified by:
getAnnotatedin classAbstractBean<T,S extends Member>- Returns:
- The annotated item
-
getEnhancedAnnotated
public abstract EnhancedAnnotatedMember<T,?,S> getEnhancedAnnotated()
Description copied from class:AbstractBeanReturns the weld-enhanced annotated item the bean represents. The item is only available during bootstrap. The method throwsIllegalStateExceptionat runtime.- Specified by:
getEnhancedAnnotatedin classAbstractBean<T,S extends Member>- Returns:
- The annotated item
-
-