org.apache.webbeans.decorator
Class WebBeansDecorator<T>

java.lang.Object
  extended by org.apache.webbeans.component.AbstractOwbBean<T>
      extended by org.apache.webbeans.component.AbstractInjectionTargetBean<T>
          extended by org.apache.webbeans.decorator.WebBeansDecorator<T>
Type Parameters:
T - decorator type info
All Implemented Interfaces:
javax.enterprise.context.spi.Contextual<T>, javax.enterprise.inject.spi.Bean<T>, javax.enterprise.inject.spi.Decorator<T>, InjectionTargetBean<T>, InterceptedMarker, OwbBean<T>, OwbDecorator<T>

public class WebBeansDecorator<T>
extends AbstractInjectionTargetBean<T>
implements OwbDecorator<T>

Defines decorators. It wraps the bean instance related with decorator class. Actually, each decorator is an instance of the ManagedBean.

Version:
$Rev$ $Date$

Field Summary
protected  Set<Annotation> delegateBindings
          Delegate field bindings
protected  Field delegateField
           
protected  Type delegateType
          Delegate field class type
 
Fields inherited from class org.apache.webbeans.component.AbstractInjectionTargetBean
decorators, inheritedMetaData, interceptorStack
 
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
WebBeansDecorator(AbstractInjectionTargetBean<T> wrappedBean)
          Creates a new decorator bean instance with the given wrapped bean.
WebBeansDecorator(AbstractInjectionTargetBean<T> wrappedBean, javax.enterprise.inject.spi.Decorator<T> customDecorator)
          Creates a new decorator bean instance with the given wrapped bean and custom decorator bean.
 
Method Summary
protected  T createInstance(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Creates the instance of the bean that has a specific implementation type.
 Class<?> getBeanClass()
          Get return types of the bean.
 Class<?> getClazz()
           
 Set<Type> getDecoratedTypes()
           
 AbstractOwbBean<T> getDelegateComponent()
           
 Set<Annotation> getDelegateQualifiers()
           
 Type getDelegateType()
           
 Set<javax.enterprise.inject.spi.InjectionPoint> getInjectionPoints()
          
 String getName()
          Name of the bean.
 Set<Annotation> getQualifiers()
           
 Class<? extends Annotation> getScope()
           
 Set<Class<? extends Annotation>> getStereotypes()
          
 Set<Type> getTypes()
           
protected  void init()
           
protected  void initDelegate()
           
 boolean isAlternative()
          
 boolean isDecoratorMatch(Set<Type> apiTypes, Set<Annotation> annotations)
           
 boolean isNullable()
          
 boolean isPassivationCapable()
          True if passivation capable false otherwise.
 boolean isSerializable()
          Returns true if bean is capable of serializable, false otherwise.
 void setDelegate(Object instance, Object delegate)
           
 void setInjections(Object proxy, javax.enterprise.context.spi.CreationalContext<?> cretionalContext)
           
 void validatePassivationDependencies()
          If bean is passivation capable, it validate all of its dependencies.
 
Methods inherited from class org.apache.webbeans.component.AbstractInjectionTargetBean
addInjectedField, addInjectedFieldToSuper, addInjectedMethod, addInjectedMethodToSuper, addObservableMethod, afterConstructor, beforeConstructor, createComponentInstance, createDefaultInstance, destroyComponentInstance, destroyInstance, getAnnotatedType, getDecoratorStack, getInheritedMetaData, getInjectedFields, getInjectedFromSuperFields, getInjectedFromSuperMethods, getInjectedMethods, getInterceptorStack, getObservableMethods, injectFields, injectMethods, injectResources, injectSuperFields, injectSuperMethods, postConstruct, postConstructDefault, preDestroy, preDestroyDefault, setAnnotatedType, setInheritedMetaData
 
Methods inherited from class org.apache.webbeans.component.AbstractOwbBean
addApiType, addInjectionPoint, addQualifier, addStereoType, create, createNewInstance, destroy, destroyCreatedInstance, equals, getId, getImplQualifiers, getImplScopeType, getInjectionPoint, getLogger, getManager, getOwbStereotypes, getReturnType, getWebBeansContext, getWebBeansType, hashCode, isDependent, isEnabled, 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 javax.enterprise.context.spi.Contextual
create, destroy
 
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, isSpecializedBean, setEnabled, setImplScopeType, setName, setNullable, setSerializable, setSpecializedBean
 

Field Detail

delegateType

protected Type delegateType
Delegate field class type


delegateBindings

protected Set<Annotation> delegateBindings
Delegate field bindings


delegateField

protected Field delegateField
Constructor Detail

WebBeansDecorator

public WebBeansDecorator(AbstractInjectionTargetBean<T> wrappedBean,
                         javax.enterprise.inject.spi.Decorator<T> customDecorator)
Creates a new decorator bean instance with the given wrapped bean and custom decorator bean.

Parameters:
wrappedBean - wrapped bean instance
customDecorator - custom decorator

WebBeansDecorator

public WebBeansDecorator(AbstractInjectionTargetBean<T> wrappedBean)
Creates a new decorator bean instance with the given wrapped bean.

Parameters:
wrappedBean - wrapped bean instance
Method Detail

init

protected void init()

initDelegate

protected void initDelegate()

isPassivationCapable

public boolean isPassivationCapable()
Description copied from interface: OwbBean
True if passivation capable false otherwise.

Specified by:
isPassivationCapable in interface OwbBean<T>
Overrides:
isPassivationCapable in class AbstractOwbBean<T>
Returns:
true if this bean is passivation capable

isDecoratorMatch

public boolean isDecoratorMatch(Set<Type> apiTypes,
                                Set<Annotation> annotations)
Specified by:
isDecoratorMatch in interface OwbDecorator<T>

getDelegateQualifiers

public Set<Annotation> getDelegateQualifiers()
Specified by:
getDelegateQualifiers in interface javax.enterprise.inject.spi.Decorator<T>

getDelegateType

public Type getDelegateType()
Specified by:
getDelegateType in interface javax.enterprise.inject.spi.Decorator<T>

setDelegate

public void setDelegate(Object instance,
                        Object delegate)
Specified by:
setDelegate in interface OwbDecorator<T>

createInstance

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

Overrides:
createInstance in class AbstractInjectionTargetBean<T>
Parameters:
creationalContext - the contextual instance shall be created in
Returns:
instance of the bean

setInjections

public void setInjections(Object proxy,
                          javax.enterprise.context.spi.CreationalContext<?> cretionalContext)
Specified by:
setInjections in interface OwbDecorator<T>

getQualifiers

public Set<Annotation> getQualifiers()
Specified by:
getQualifiers in interface javax.enterprise.inject.spi.Bean<T>
Overrides:
getQualifiers in class AbstractOwbBean<T>

getName

public String getName()
Description copied from class: AbstractOwbBean
Name of the bean.

Specified by:
getName in interface javax.enterprise.inject.spi.Bean<T>
Overrides:
getName in class AbstractOwbBean<T>
Returns:
name of the bean

getScope

public Class<? extends Annotation> getScope()
Specified by:
getScope in interface javax.enterprise.inject.spi.Bean<T>
Overrides:
getScope in class AbstractOwbBean<T>

getTypes

public Set<Type> getTypes()
Specified by:
getTypes in interface javax.enterprise.inject.spi.Bean<T>
Overrides:
getTypes in class AbstractOwbBean<T>

isNullable

public boolean isNullable()
Description copied from class: AbstractOwbBean

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

isSerializable

public boolean isSerializable()
Description copied from class: AbstractOwbBean
Returns true if bean is capable of serializable, false otherwise.

Specified by:
isSerializable in interface OwbBean<T>
Overrides:
isSerializable in class AbstractOwbBean<T>
Returns:
true if bean is serializable

getDelegateComponent

public AbstractOwbBean<T> getDelegateComponent()
Specified by:
getDelegateComponent in interface OwbDecorator<T>
Returns:
the delegateComponent

getInjectionPoints

public Set<javax.enterprise.inject.spi.InjectionPoint> getInjectionPoints()
Description copied from class: AbstractInjectionTargetBean

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

getClazz

public Class<?> getClazz()
Returns:
the clazz

getBeanClass

public Class<?> getBeanClass()
Description copied from class: AbstractOwbBean
Get return types of the bean.

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

getStereotypes

public Set<Class<? extends Annotation>> getStereotypes()
Description copied from class: AbstractOwbBean

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

getDecoratedTypes

public Set<Type> getDecoratedTypes()
Specified by:
getDecoratedTypes in interface javax.enterprise.inject.spi.Decorator<T>

isAlternative

public boolean isAlternative()
Description copied from class: AbstractOwbBean

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

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


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