org.apache.webbeans.component
Class AbstractInjectionTargetBean<T>

java.lang.Object
  extended by org.apache.webbeans.component.AbstractOwbBean<T>
      extended by org.apache.webbeans.component.AbstractInjectionTargetBean<T>
Type Parameters:
T - bean class
All Implemented Interfaces:
javax.enterprise.context.spi.Contextual<T>, javax.enterprise.inject.spi.Bean<T>, InjectionTargetBean<T>, OwbBean<T>
Direct Known Subclasses:
ConversationBean, ExtensionBean, ManagedBean, WebBeansDecorator

public abstract class AbstractInjectionTargetBean<T>
extends AbstractOwbBean<T>
implements InjectionTargetBean<T>

Abstract class for injection target beans.

Version:
$Rev: 1243672 $ $Date: 2012-02-13 21:07:34 +0100 (Mo, 13 Feb 2012) $

Field Summary
protected  List<javax.enterprise.inject.spi.Decorator<?>> decorators
          Decorators
protected  IBeanInheritedMetaData inheritedMetaData
          Bean inherited meta data
protected  List<InterceptorData> interceptorStack
          Holds the all of the interceptor related data, contains around-invoke, post-construct and pre-destroy
 
Fields inherited from class org.apache.webbeans.component.AbstractOwbBean
apiTypes, enabled, implQualifiers, implScopeType, injectionPoints, name, nullable, passivatingId, returnType, scopeClass, serializable, specializedBean, stereoTypeClasses, stereoTypes, webBeansType
 
Constructor Summary
protected AbstractInjectionTargetBean(WebBeansType webBeansType, Class<T> returnType, WebBeansContext webBeansContext)
          Creates a new observer owner component.
 
Method Summary
 void addInjectedField(Field field)
          Add new injected field.
 void addInjectedFieldToSuper(Field field)
          Add new injected field.
 void addInjectedMethod(Method method)
          Add new injected method.
 void addInjectedMethodToSuper(Method method)
          Add new injected method.
 void addObservableMethod(Method observerMethod)
          Adds new observer method.
protected  void afterConstructor(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Called after bean instance is created.
protected  void beforeConstructor()
          Called before constructor.
protected  T createComponentInstance(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Sub-classes must override this method to create bean instance.
protected  T createDefaultInstance(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Returns bean instance.
protected  T createInstance(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Creates the instance of the bean that has a specific implementation type.
protected  void destroyComponentInstance(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Sub-classes must override this method to destroy bean instance.
protected  void destroyInstance(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Destroy the instance of the bean.
 javax.enterprise.inject.spi.AnnotatedType<T> getAnnotatedType()
          Gets annotated type.
 List<javax.enterprise.inject.spi.Decorator<?>> getDecoratorStack()
          Gets decorator stack of bean instance.
 IBeanInheritedMetaData getInheritedMetaData()
          Gets inherited meta data.
 Set<Field> getInjectedFields()
          Gets injected fields.
 Set<Field> getInjectedFromSuperFields()
          Gets injected from super fields.
 Set<Method> getInjectedFromSuperMethods()
          Gets injected from super methods.
 Set<Method> getInjectedMethods()
          Gets injected methods.
 Set<javax.enterprise.inject.spi.InjectionPoint> getInjectionPoints()
          
 List<InterceptorData> getInterceptorStack()
          Gets interceptor stack of bean instance.
 Set<Method> getObservableMethods()
          Returns set of observable methods.
 void injectFields(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Injects fields of the bean after constructing.
 void injectMethods(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Injects all Inject methods of the bean instance.
 void injectResources(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Inject JavaEE resources.
 void injectSuperFields(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Inject fields of the bean instance.
 void injectSuperMethods(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Inject initializer methods of the bean instance.
 void postConstruct(T instance, javax.enterprise.context.spi.CreationalContext<T> cretionalContext)
          Calls post constrcut method.
protected  void postConstructDefault(T instance, javax.enterprise.context.spi.CreationalContext<T> ownerCreationalContext)
          Default post construct.
 void preDestroy(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Calls predestroy method.
protected  void preDestroyDefault(T instance, javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Default predestroy.
 void setAnnotatedType(javax.enterprise.inject.spi.AnnotatedType<T> annotatedType)
          Sets annotated type.
protected  void setInheritedMetaData()
          Sets inherited meta data.
 void validatePassivationDependencies()
          If bean is passivation capable, it validate all of its dependencies.
 
Methods inherited from class org.apache.webbeans.component.AbstractOwbBean
addApiType, addInjectionPoint, addQualifier, addStereoType, create, createNewInstance, destroy, destroyCreatedInstance, equals, getBeanClass, getId, getImplQualifiers, getImplScopeType, getInjectionPoint, getLogger, getManager, getName, getOwbStereotypes, getQualifiers, getReturnType, getScope, getStereotypes, getTypes, getWebBeansContext, getWebBeansType, hashCode, isAlternative, isDependent, isEnabled, isNullable, isPassivationCapable, isSerializable, isSpecializedBean, setEnabled, setImplScopeType, setName, setNullable, setSerializable, setSpecializedBean, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.webbeans.component.OwbBean
addApiType, addInjectionPoint, addQualifier, addStereoType, createNewInstance, destroyCreatedInstance, getId, getImplQualifiers, getImplScopeType, getInjectionPoint, getOwbStereotypes, getReturnType, getWebBeansContext, getWebBeansType, isDependent, isEnabled, isPassivationCapable, isSerializable, isSpecializedBean, setEnabled, setImplScopeType, setName, setNullable, setSerializable, setSpecializedBean
 
Methods inherited from interface javax.enterprise.inject.spi.Bean
getBeanClass, getName, getQualifiers, getScope, getStereotypes, getTypes, isAlternative, isNullable
 
Methods inherited from interface javax.enterprise.context.spi.Contextual
create, destroy
 

Field Detail

interceptorStack

protected List<InterceptorData> interceptorStack
Holds the all of the interceptor related data, contains around-invoke, post-construct and pre-destroy


decorators

protected List<javax.enterprise.inject.spi.Decorator<?>> decorators
Decorators


inheritedMetaData

protected IBeanInheritedMetaData inheritedMetaData
Bean inherited meta data

Constructor Detail

AbstractInjectionTargetBean

protected AbstractInjectionTargetBean(WebBeansType webBeansType,
                                      Class<T> returnType,
                                      WebBeansContext webBeansContext)
Creates a new observer owner component.

Parameters:
webBeansType - webbean type
returnType - bean class type
webBeansContext -
Method Detail

createInstance

protected T createInstance(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Creates the instance of the bean that has a specific implementation type. Each subclass must define its own create mechanism.

Specified by:
createInstance in class AbstractOwbBean<T>
Parameters:
creationalContext - the contextual instance shall be created in
Returns:
instance of the bean

createDefaultInstance

protected T createDefaultInstance(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Returns bean instance.

Parameters:
creationalContext - creational context
Returns:
bean instance

destroyInstance

protected void destroyInstance(T instance,
                               javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Destroy the instance of the bean. Each subclass must define its own destroy mechanism.

Overrides:
destroyInstance in class AbstractOwbBean<T>
Parameters:
instance - instance of the bean that is being destroyed
creationalContext - the contextual instance has been created in

createComponentInstance

protected T createComponentInstance(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Sub-classes must override this method to create bean instance.

Parameters:
creationalContext - creational context
Returns:
bean instance

destroyComponentInstance

protected void destroyComponentInstance(T instance,
                                        javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Sub-classes must override this method to destroy bean instance.

Parameters:
instance - object instance.

beforeConstructor

protected void beforeConstructor()
Called before constructor.


afterConstructor

protected void afterConstructor(T instance,
                                javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Called after bean instance is created.

Parameters:
instance - bean instance
creationalContext - cretional context object

postConstruct

public void postConstruct(T instance,
                          javax.enterprise.context.spi.CreationalContext<T> cretionalContext)
Calls post constrcut method.

Specified by:
postConstruct in interface InjectionTargetBean<T>
Parameters:
instance - bean instance

postConstructDefault

protected void postConstructDefault(T instance,
                                    javax.enterprise.context.spi.CreationalContext<T> ownerCreationalContext)
Default post construct.

Parameters:
instance - bean instance

preDestroy

public void preDestroy(T instance,
                       javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Calls predestroy method.

Specified by:
preDestroy in interface InjectionTargetBean<T>
Parameters:
instance - bean instance

preDestroyDefault

protected void preDestroyDefault(T instance,
                                 javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Default predestroy.

Parameters:
instance - bean instance

injectFields

public void injectFields(T instance,
                         javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Injects fields of the bean after constructing.

Specified by:
injectFields in interface InjectionTargetBean<T>
Parameters:
instance - bean instance
creationalContext - creational context

injectSuperFields

public void injectSuperFields(T instance,
                              javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Description copied from interface: InjectionTargetBean
Inject fields of the bean instance.

Specified by:
injectSuperFields in interface InjectionTargetBean<T>
Parameters:
instance - bean instance
creationalContext - creational context

injectSuperMethods

public void injectSuperMethods(T instance,
                               javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Description copied from interface: InjectionTargetBean
Inject initializer methods of the bean instance.

Specified by:
injectSuperMethods in interface InjectionTargetBean<T>
Parameters:
instance - bean instance
creationalContext - creational context

injectMethods

public void injectMethods(T instance,
                          javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Injects all Inject methods of the bean instance.

Specified by:
injectMethods in interface InjectionTargetBean<T>
Parameters:
instance - bean instance
creationalContext - creational context instance

injectResources

public void injectResources(T instance,
                            javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Inject JavaEE resources.

Specified by:
injectResources in interface InjectionTargetBean<T>
Parameters:
instance - bean instance
creationalContext - creational context

addObservableMethod

public void addObservableMethod(Method observerMethod)
Adds new observer method.

Specified by:
addObservableMethod in interface InjectionTargetBean<T>
Parameters:
observerMethod - observer method

getObservableMethods

public Set<Method> getObservableMethods()
Returns set of observable methods.

Specified by:
getObservableMethods in interface InjectionTargetBean<T>
Returns:
set of observable methods

getInjectedFields

public Set<Field> getInjectedFields()
Gets injected fields.

Specified by:
getInjectedFields in interface InjectionTargetBean<T>
Returns:
injected fields

addInjectedField

public void addInjectedField(Field field)
Add new injected field.

Specified by:
addInjectedField in interface InjectionTargetBean<T>
Parameters:
field - new injected field

getInjectedFromSuperFields

public Set<Field> getInjectedFromSuperFields()
Gets injected from super fields.

Specified by:
getInjectedFromSuperFields in interface InjectionTargetBean<T>
Returns:
injected fields

addInjectedFieldToSuper

public void addInjectedFieldToSuper(Field field)
Add new injected field.

Specified by:
addInjectedFieldToSuper in interface InjectionTargetBean<T>
Parameters:
field - new injected field

getInjectedMethods

public Set<Method> getInjectedMethods()
Gets injected methods.

Specified by:
getInjectedMethods in interface InjectionTargetBean<T>
Returns:
injected methods

addInjectedMethod

public void addInjectedMethod(Method method)
Add new injected method.

Specified by:
addInjectedMethod in interface InjectionTargetBean<T>
Parameters:
method - new injected method

getInjectedFromSuperMethods

public Set<Method> getInjectedFromSuperMethods()
Gets injected from super methods.

Specified by:
getInjectedFromSuperMethods in interface InjectionTargetBean<T>
Returns:
injected methods

addInjectedMethodToSuper

public void addInjectedMethodToSuper(Method method)
Add new injected method.

Specified by:
addInjectedMethodToSuper in interface InjectionTargetBean<T>
Parameters:
method - new injected method

getInterceptorStack

public List<InterceptorData> getInterceptorStack()
Gets interceptor stack of bean instance.

Specified by:
getInterceptorStack in interface InjectionTargetBean<T>
Returns:
interceptor stack

getDecoratorStack

public List<javax.enterprise.inject.spi.Decorator<?>> getDecoratorStack()
Description copied from interface: InjectionTargetBean
Gets decorator stack of bean instance.

Specified by:
getDecoratorStack in interface InjectionTargetBean<T>
Returns:
decorator stack

getInheritedMetaData

public IBeanInheritedMetaData getInheritedMetaData()
Gets inherited meta data.

Specified by:
getInheritedMetaData in interface InjectionTargetBean<T>
Returns:
inherited meta data

setInheritedMetaData

protected void setInheritedMetaData()
Sets inherited meta data.


getInjectionPoints

public Set<javax.enterprise.inject.spi.InjectionPoint> getInjectionPoints()

Specified by:
getInjectionPoints in interface javax.enterprise.inject.spi.Bean<T>
Overrides:
getInjectionPoints in class AbstractOwbBean<T>

getAnnotatedType

public javax.enterprise.inject.spi.AnnotatedType<T> getAnnotatedType()
Gets annotated type.

Specified by:
getAnnotatedType in interface InjectionTargetBean<T>
Returns:
annotated type

setAnnotatedType

public void setAnnotatedType(javax.enterprise.inject.spi.AnnotatedType<T> annotatedType)
Sets annotated type.

Specified by:
setAnnotatedType in interface InjectionTargetBean<T>
Parameters:
annotatedType - annotated type

validatePassivationDependencies

public void validatePassivationDependencies()
Description copied from interface: OwbBean
If bean is passivation capable, it validate all of its dependencies.

Specified by:
validatePassivationDependencies in interface OwbBean<T>
Overrides:
validatePassivationDependencies in class AbstractOwbBean<T>


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.