org.jboss.weld.bean
Class ManagedBean<T>

java.lang.Object
  extended by org.jboss.weld.bean.RIBean<T>
      extended by org.jboss.weld.bean.AbstractBean<T,java.lang.Class<T>>
          extended by org.jboss.weld.bean.AbstractClassBean<T>
              extended by org.jboss.weld.bean.ManagedBean<T>
Type Parameters:
T - The type (class) of the bean
All Implemented Interfaces:
javax.enterprise.context.spi.Contextual<T>, javax.enterprise.inject.spi.Bean<T>, javax.enterprise.inject.spi.PassivationCapable
Direct Known Subclasses:
DecoratorImpl, InterceptorImpl, NewManagedBean

public class ManagedBean<T>
extends AbstractClassBean<T>

Represents a simple bean

Author:
Pete Muir, Marius Bogoevici

Field Summary
 
Fields inherited from class org.jboss.weld.bean.AbstractClassBean
annotatedItem
 
Fields inherited from class org.jboss.weld.bean.AbstractBean
alternative, beanManager, name, qualifiers, scope, type, types
 
Fields inherited from class org.jboss.weld.bean.RIBean
BEAN_ID_PREFIX, BEAN_ID_SEPARATOR
 
Constructor Summary
protected ManagedBean(WeldClass<T> type, java.lang.String idSuffix, BeanManagerImpl beanManager)
          Constructor
 
Method Summary
protected  T applyInterceptors(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
           
protected  void checkBeanImplementation()
          Validates the bean implementation
 void checkType()
          Validates the type
 T create(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Creates an instance of the bean
protected static java.lang.String createId(java.lang.String beanType, WeldClass<?> clazz)
          create a more complete id for types that have been added through the SPI to prevent duplicate id's
protected  T createInstance(javax.enterprise.context.spi.CreationalContext<T> ctx)
           
protected static java.lang.String createSimpleId(java.lang.String beanType, WeldClass<?> clazz)
           
 void destroy(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Destroys an instance of the bean
 ManagedBean<?> getSpecializedBean()
           
 void initialize(BeanDeployerEnvironment environment)
          Initializes the bean and its metadata
 void initializeAfterBeanDiscovery()
          In particular cases, the deployer must perform some initialization operations only after all beans have been deployed (e.g.
protected  boolean isInterceptionCandidate()
           
 boolean isPassivationCapableBean()
           
 boolean isPassivationCapableDependency()
           
static
<T> ManagedBean<T>
of(WeldClass<T> clazz, BeanManagerImpl beanManager)
          Creates a simple, annotation defined Web Bean
protected  void preSpecialize(BeanDeployerEnvironment environment)
           
protected  void specialize(BeanDeployerEnvironment environment)
           
 
Methods inherited from class org.jboss.weld.bean.AbstractClassBean
applyDecorators, checkConstructor, defaultPostConstruct, defaultPreDestroy, flattenInterceptorBindings, getConstructor, getDecorators, getDefaultName, getInitializerMethods, getInjectableFields, getInjectionPoints, getInjectionTarget, getPostConstruct, getPreDestroy, getWeldAnnotated, hasCdiBoundInterceptors, hasDecorators, hasDirectlyDefinedInterceptors, initCdiBoundInterceptors, initConstructor, initDecorators, initDirectlyDefinedInterceptors, initInitializerMethods, initInjectableFields, initPostConstruct, initPreDestroy, initProxyClassForDecoratedBean, initScope, initType, setInjectionTarget
 
Methods inherited from class org.jboss.weld.bean.AbstractBean
addInjectionPoint, addInjectionPoints, checkDelegateInjectionPoints, getDelegateInjectionPoints, getMergedStereotypes, getName, getNewInjectionPoints, getQualifiers, getScope, getStereotypes, getType, getTypedTypes, getTypes, getWeldInjectionPoints, initAlternative, initDefaultQualifiers, initName, initQualifiers, initScopeFromStereotype, initStereotypes, initTypes, isAlternative, isDependent, isInitialized, isNormalScoped, isNullable, isPrimitive, isProxyable, isSpecializing, postSpecialize
 
Methods inherited from class org.jboss.weld.bean.RIBean
equals, getBeanClass, getBeanManager, getId, hashCode, isProxyRequired, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ManagedBean

protected ManagedBean(WeldClass<T> type,
                      java.lang.String idSuffix,
                      BeanManagerImpl beanManager)
Constructor

Parameters:
type - The type of the bean
beanManager - The Bean manager
Method Detail

of

public static <T> ManagedBean<T> of(WeldClass<T> clazz,
                                    BeanManagerImpl beanManager)
Creates a simple, annotation defined Web Bean

Type Parameters:
T - The type
Parameters:
clazz - The class
beanManager - the current manager
Returns:
A Web Bean

createSimpleId

protected static java.lang.String createSimpleId(java.lang.String beanType,
                                                 WeldClass<?> clazz)

createId

protected static java.lang.String createId(java.lang.String beanType,
                                           WeldClass<?> clazz)
create a more complete id for types that have been added through the SPI to prevent duplicate id's


create

public T create(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Creates an instance of the bean

Returns:
The instance

destroy

public void destroy(T instance,
                    javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Destroys an instance of the bean

Parameters:
instance - The instance

initialize

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

Overrides:
initialize in class AbstractClassBean<T>

createInstance

protected T createInstance(javax.enterprise.context.spi.CreationalContext<T> ctx)

initializeAfterBeanDiscovery

public void initializeAfterBeanDiscovery()
Description copied from class: RIBean
In particular cases, the deployer must perform some initialization operations only after all beans have been deployed (e.g. for initializing decorators taking into account the possibility of having custom decorators which are deployed through portable extensions)

Overrides:
initializeAfterBeanDiscovery in class AbstractClassBean<T>

isPassivationCapableBean

public boolean isPassivationCapableBean()
Specified by:
isPassivationCapableBean in class RIBean<T>

isPassivationCapableDependency

public boolean isPassivationCapableDependency()
Specified by:
isPassivationCapableDependency in class RIBean<T>

checkType

public void checkType()
Validates the type

Overrides:
checkType in class AbstractClassBean<T>

checkBeanImplementation

protected void checkBeanImplementation()
Description copied from class: AbstractClassBean
Validates the bean implementation

Overrides:
checkBeanImplementation in class AbstractClassBean<T>

preSpecialize

protected void preSpecialize(BeanDeployerEnvironment environment)
Overrides:
preSpecialize in class AbstractClassBean<T>

specialize

protected void specialize(BeanDeployerEnvironment environment)
Overrides:
specialize in class AbstractBean<T,java.lang.Class<T>>

getSpecializedBean

public ManagedBean<?> getSpecializedBean()
Specified by:
getSpecializedBean in class AbstractBean<T,java.lang.Class<T>>

isInterceptionCandidate

protected boolean isInterceptionCandidate()
Specified by:
isInterceptionCandidate in class AbstractClassBean<T>

applyInterceptors

protected T applyInterceptors(T instance,
                              javax.enterprise.context.spi.CreationalContext<T> creationalContext)


Copyright © 2008-2010 Seam Framework. All Rights Reserved.