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, 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 init()
          Initializes the bean and its metadata
protected  void initConstructor()
          Initializes the constructor
protected  void initEjbInjectionPoints()
           
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 initSpecialization()
           
protected  void initType()
          Initializes the bean type
protected  void injectEjbAndCommonFields(T beanInstance)
          Injects EJBs and common fields
 boolean isSerializable()
          Indicates if the bean is serializable
static
<T> SimpleBean<T>
of(AnnotatedClass<T> clazz, ManagerImpl manager)
          Creates a simple, annotation defined Web Bean
static
<T> SimpleBean<T>
of(java.lang.Class<T> clazz, ManagerImpl manager)
          Creates a simple, annotation defined Web Bean
protected  void preCheckSpecialization()
           
 java.lang.String toString()
          Gets a string representation
 
Methods inherited from class org.jboss.webbeans.bean.AbstractClassBean
callInitializers, checkScopeAllowed, equals, getAnnotatedItem, getDefaultDeploymentType, getDefaultName, getInitializerMethods, initDeploymentType, initInitializerMethods, initScopeType, injectBoundFields
 
Methods inherited from class org.jboss.webbeans.bean.AbstractBean
bindDecorators, bindInterceptors, checkDeploymentType, checkInjectionPointsAreSerializable, checkRequiredTypesImplemented, getBindings, getDependentInstancesStore, getDeploymentType, getDeploymentType, getInjectionPoints, getMergedStereotypes, getName, getScopeType, getType, getTypes, hashCode, initBindingTypes, initDefaultBindings, initDeploymentTypeFromStereotype, initName, initPrimitive, initProxyable, initScopeTypeFromStereotype, initSerializable, initTypes, isAssignableFrom, isDependent, isNullable, isPrimitive, isProxyable, isSpecializing, postSpecialization
 
Methods inherited from class org.jboss.webbeans.bean.RIBean
getManager
 
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(java.lang.Class<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

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

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


init

protected void init()
Initializes the bean and its metadata

Overrides:
init 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>

preCheckSpecialization

protected void preCheckSpecialization()
Overrides:
preCheckSpecialization in class AbstractClassBean<T>

initSpecialization

protected void initSpecialization()
Overrides:
initSpecialization 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


initType

protected void initType()
Initializes the bean type

Overrides:
initType in class AbstractClassBean<T>

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

isSerializable

public boolean isSerializable()
Indicates if the bean is serializable

Overrides:
isSerializable in class AbstractBean<T,java.lang.Class<T>>
Returns:
true If serializable, false otherwise

getSpecializedBean

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


Copyright © 2008-2009. All Rights Reserved.