org.jboss.webbeans.bean
Class SimpleBean<T>

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,java.lang.Class<T>>
              extended by org.jboss.webbeans.bean.AbstractClassBean<T>
                  extended by org.jboss.webbeans.bean.SimpleBean<T>
Type Parameters:
T - The type (class) of the bean
All Implemented Interfaces:
Contextual<T>
Direct Known Subclasses:
NewSimpleBean

public class SimpleBean<T>
extends AbstractClassBean<T>

Represents a simple bean

Author:
Pete Muir

Field Summary
 
Fields inherited from class org.jboss.webbeans.bean.AbstractClassBean
annotatedItem
 
Fields inherited from class org.jboss.webbeans.bean.AbstractBean
_serializable, bindings, dependentInstancesStore, deploymentType, injectionPoints, manager, name, scopeType, type, types
 
Constructor Summary
protected SimpleBean(AnnotatedClass<T> type, ManagerImpl manager)
          Constructor
 
Method Summary
protected  void callPostConstruct(T instance)
          Calls the post-construct method, if any
protected  void callPreDestroy(T instance)
          Calls the pre-destroy method, if any
protected  void checkBeanImplementation()
          Validates the bean implementation
protected  void checkType()
          Validates the type
 T create(CreationalContext<T> creationalContext)
          Creates an instance of the bean
 void destroy(T instance)
          Destroys an instance of the bean
 AnnotatedConstructor<T> getConstructor()
          Returns the constructor
 AnnotatedMethod<?> getPostConstruct()
          Returns the post-construct method
 AnnotatedMethod<?> getPreDestroy()
          Returns the pre-destroy method
 SimpleBean<?> getSpecializedBean()
           
protected  void initConstructor()
          Initializes the constructor
protected  void initEjbInjectionPoints()
           
 void initialize(BeanDeployerEnvironment environment)
          Initializes the bean and its metadata
protected  void initInjectionPoints()
          Initializes the injection points
protected  void initPersistenceUnitInjectionPoints()
           
protected  void initPostConstruct()
          Initializes the post-construct method
protected  void initPreDestroy()
          Initializes the pre-destroy method
protected  void initResourceInjectionPoints()
           
protected  void injectEjbAndCommonFields(T beanInstance)
          Injects EJBs and common fields
static
<T> SimpleBean<T>
of(AnnotatedClass<T> clazz, ManagerImpl manager)
          Creates a simple, annotation defined Web Bean
protected  void preSpecialize(BeanDeployerEnvironment environment)
           
protected  void specialize(BeanDeployerEnvironment environment)
           
 java.lang.String toString()
          Gets a string representation
 
Methods inherited from class org.jboss.webbeans.bean.AbstractClassBean
callInitializers, checkScopeAllowed, getAnnotatedItem, getDefaultDeploymentType, getDefaultName, getId, getInitializerMethods, getSuperclasses, initDeploymentType, initInitializerMethods, initScopeType, initType, injectBoundFields
 
Methods inherited from class org.jboss.webbeans.bean.AbstractBean
checkDeploymentType, checkRequiredTypesImplemented, getBindings, getDeploymentType, getDeploymentType, getInjectionPoints, getMergedStereotypes, getName, getScopeType, getType, getTypes, initBindings, initDefaultBindings, initDeploymentTypeFromStereotype, initName, initPrimitive, initProxyable, initScopeTypeFromStereotype, initSerializable, initTypes, isAssignableFrom, isDependent, isInitialized, isNullable, isPrimitive, isProxyable, isSerializable, isSpecializing, postSpecialize
 
Methods inherited from class org.jboss.webbeans.bean.RIBean
createId, equals, getManager, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleBean

protected SimpleBean(AnnotatedClass<T> type,
                     ManagerImpl manager)
Constructor

Parameters:
type - The type of the bean
manager - The Web Beans manager
Method Detail

of

public static <T> SimpleBean<T> of(AnnotatedClass<T> clazz,
                                   ManagerImpl manager)
Creates a simple, annotation defined Web Bean

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

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 instance

destroy

public void destroy(T instance)
Destroys an instance of the bean

Parameters:
instance - The instance

callPreDestroy

protected void callPreDestroy(T instance)
Calls the pre-destroy method, if any

Parameters:
instance - The instance to invoke the method on

callPostConstruct

protected void callPostConstruct(T instance)
Calls the post-construct method, if any

Parameters:
instance - The instance to invoke the method on

initEjbInjectionPoints

protected void initEjbInjectionPoints()

initPersistenceUnitInjectionPoints

protected void initPersistenceUnitInjectionPoints()

initResourceInjectionPoints

protected void initResourceInjectionPoints()

injectEjbAndCommonFields

protected void injectEjbAndCommonFields(T beanInstance)
Injects EJBs and common fields


initialize

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

Overrides:
initialize in class AbstractClassBean<T>

initInjectionPoints

protected void initInjectionPoints()
Initializes the injection points

Overrides:
initInjectionPoints in class AbstractClassBean<T>

checkType

protected void checkType()
Validates the type


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>>

initConstructor

protected void initConstructor()
Initializes the constructor


initPostConstruct

protected void initPostConstruct()
Initializes the post-construct method


initPreDestroy

protected void initPreDestroy()
Initializes the pre-destroy method


getConstructor

public AnnotatedConstructor<T> getConstructor()
Returns the constructor

Returns:
The constructor

getPostConstruct

public AnnotatedMethod<?> getPostConstruct()
Returns the post-construct method

Returns:
The post-construct method

getPreDestroy

public AnnotatedMethod<?> getPreDestroy()
Returns the pre-destroy method

Returns:
The pre-destroy method

toString

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

Overrides:
toString in class AbstractClassBean<T>
Returns:
The string representation

getSpecializedBean

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


Copyright © 2011. All Rights Reserved.