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

java.lang.Object
  extended by javax.webbeans.manager.Bean<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 -
All Implemented Interfaces:
Contextual<T>

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
apiTypes, deploymentType, injectionPoints, manager, name, scopeType, type
 
Constructor Summary
SimpleBean(java.lang.Class<T> type, ManagerImpl manager)
          Constructor
 
Method Summary
protected  void callInitializers(T instance)
          Calls any initializers
protected  void callPostConstruct(T instance)
          Calls the post-construct method, if any
protected  void callPreDestroy(T instance)
          Calls the pre-destroy method, if any
static void checkType(java.lang.Class<?> type)
          Validates the type
 T create()
          Creates an instance of the bean
 void destroy(T instance)
          Destroys an instance of the bean
 AnnotatedConstructor<T> getConstructor()
          Returns the constructor
 AnnotatedMethod<java.lang.Object> getPostConstruct()
          Returns the post-construct method
 AnnotatedMethod<java.lang.Object> getPreDestroy()
          Returns the pre-destroy method
protected  AbstractBean<? extends T,java.lang.Class<T>> getSpecializedType()
          Returns the specializes type of the bean
protected  void init()
          Initializes the bean and its metadata
protected  void initConstructor()
          Initializes the constructor
protected  void initInjectionPoints()
          Initializes the injection points
protected  void initPostConstruct()
          Initializes the post-construct method
protected  void initPreDestroy()
          Initializes the pre-destroy method
protected  void injectBoundFields(T instance, Manager manager)
          Injects bound fields
protected  void injectEjbAndCommonFields()
          Injects EJBs and common fields
 java.lang.String toDetailedString()
           
 java.lang.String toString()
          Gets a string representation
 
Methods inherited from class org.jboss.webbeans.bean.AbstractClassBean
checkBeanImplementation, checkRequiredTypesImplemented, checkScopeAllowed, getAnnotatedItem, getDefaultDeploymentType, getDefaultName, getInitializerMethods, getInjectableFields, getObserverMethods, getProducerFields, getProducerMethods, initInitializerMethods, initType
 
Methods inherited from class org.jboss.webbeans.bean.AbstractBean
bindDecorators, bindInterceptors, checkDeploymentType, getBindingTypes, getDeclaredBeanType, getDeploymentType, getDeploymentType, getInjectionPoints, getMergedStereotypes, getName, getScopeType, getType, getTypes, initApiTypes, initBindingTypes, initDeploymentType, initName, initPrimitive, initScopeType, isAssignableFrom, isNullable, isPrimitive, isSerializable
 
Methods inherited from class javax.webbeans.manager.Bean
getManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleBean

public SimpleBean(java.lang.Class<T> type,
                  ManagerImpl manager)
Constructor

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

create

public T create()
Creates an instance of the bean

Specified by:
create in interface Contextual<T>
Specified by:
create in class Bean<T>
Returns:
The instance

destroy

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

Specified by:
destroy in interface Contextual<T>
Specified by:
destroy in class Bean<T>
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

callInitializers

protected void callInitializers(T instance)
Calls any initializers

Parameters:
instance - The instance to invoke the initializers on

injectEjbAndCommonFields

protected void injectEjbAndCommonFields()
Injects EJBs and common fields


injectBoundFields

protected void injectBoundFields(T instance,
                                 Manager manager)
Injects bound fields

Parameters:
instance - The instance to inject into
manager - The Web Beans manager

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

public static void checkType(java.lang.Class<?> type)
Validates the type

Parameters:
type - The type to validate

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

getSpecializedType

protected AbstractBean<? extends T,java.lang.Class<T>> getSpecializedType()
Returns the specializes type of the bean

Overrides:
getSpecializedType in class AbstractBean<T,java.lang.Class<T>>
Returns:
The specialized type

getPostConstruct

public AnnotatedMethod<java.lang.Object> getPostConstruct()
Returns the post-construct method

Returns:
The post-construct method

getPreDestroy

public AnnotatedMethod<java.lang.Object> 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

toDetailedString

public java.lang.String toDetailedString()
Overrides:
toDetailedString in class AbstractClassBean<T>


Copyright © 2008. All Rights Reserved.