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,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, Ales Justin

Field Summary
 
Fields inherited from class org.jboss.weld.bean.AbstractClassBean
annotatedItem, constructorForEnhancedSubclass, decoratorProxyFactory, enhancedSubclass
 
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, String idSuffix, BeanManagerImpl beanManager, org.jboss.weld.bootstrap.api.ServiceRegistry services)
          Constructor
 
Method Summary
protected  T applyInterceptors(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
           
protected  void checkBeanImplementation()
          Validates the bean implementation
protected  void checkType()
          Validates the type
 T create(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Creates an instance of the bean
protected static String createId(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 String createSimpleId(String beanType, WeldClass<?> clazz)
           
 void destroy(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Destroys an instance of the bean
 ManagedBean<?> getSpecializedBean()
           
 boolean hasDefaultProducer()
          Returns true if the bean uses the default Producer ( or InjectionTarget).
 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()
           
 boolean isProxyable()
           
static
<T> ManagedBean<T>
of(WeldClass<T> clazz, BeanManagerImpl beanManager, org.jboss.weld.bootstrap.api.ServiceRegistry services)
          Creates a simple, annotation defined Web Bean
protected  void preSpecialize(BeanDeployerEnvironment environment)
           
protected  void specialize(BeanDeployerEnvironment environment)
           
 String toString()
           
 
Methods inherited from class org.jboss.weld.bean.AbstractClassBean
applyDecorators, checkConstructor, createEnhancedSubclass, defaultPostConstruct, defaultPreDestroy, getConstructor, getDecorators, getDefaultName, getInitializerMethods, getInjectableFields, getInjectionPoints, getInjectionTarget, getPostConstruct, getPreDestroy, getWeldAnnotated, hasDecorators, hasInterceptors, initConstructor, initDecorators, initEnhancedSubclass, initInitializerMethods, initInjectableFields, initInterceptorsIfNeeded, initPostConstruct, initPreDestroy, initScope, initType, isSubclassed, setInjectionTarget
 
Methods inherited from class org.jboss.weld.bean.AbstractBean
addInjectionPoint, addInjectionPoints, checkDelegateInjectionPoints, cleanupAfterBoot, getDelegateInjectionPoints, getMergedStereotypes, getName, getNewInjectionPoints, getQualifiers, getScope, getServices, getStereotypes, getType, getTypedTypes, getTypes, getWeldInjectionPoints, initAlternative, initDefaultQualifiers, initName, initQualifiers, initScopeFromStereotype, initStereotypes, initTypes, isAlternative, isDependent, isInitialized, isNormalScoped, isNullable, isPrimitive, isProxyRequired, isSpecializing, postSpecialize
 
Methods inherited from class org.jboss.weld.bean.RIBean
equals, getBeanClass, getBeanManager, getId, getQualifierInstances, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ManagedBean

protected ManagedBean(WeldClass<T> type,
                      String idSuffix,
                      BeanManagerImpl beanManager,
                      org.jboss.weld.bootstrap.api.ServiceRegistry services)
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,
                                    org.jboss.weld.bootstrap.api.ServiceRegistry services)
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 String createSimpleId(String beanType,
                                       WeldClass<?> clazz)

createId

protected static String createId(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

protected void checkType()
Validates the type

Specified by:
checkType in class AbstractBean<T,Class<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,Class<T>>

getSpecializedBean

public ManagedBean<?> getSpecializedBean()
Specified by:
getSpecializedBean in class AbstractBean<T,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)

toString

public String toString()
Overrides:
toString in class RIBean<T>

isProxyable

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

hasDefaultProducer

public boolean hasDefaultProducer()
Description copied from class: AbstractBean
Returns true if the bean uses the default Producer ( or InjectionTarget). The method returns false if the producer of the bean was replaced by an extension.

Specified by:
hasDefaultProducer in class AbstractBean<T,Class<T>>


Copyright © 2013 Seam Framework. All Rights Reserved.