org.apache.webbeans.intercept.webbeans
Class WebBeansInterceptor<T>

java.lang.Object
  extended by org.apache.webbeans.component.AbstractOwbBean<T>
      extended by org.apache.webbeans.intercept.webbeans.WebBeansInterceptor<T>
All Implemented Interfaces:
javax.enterprise.context.spi.Contextual<T>, javax.enterprise.inject.spi.Bean<T>, javax.enterprise.inject.spi.Interceptor<T>, OwbBean<T>, OwbInterceptor<T>
Direct Known Subclasses:
CustomInterceptor

public class WebBeansInterceptor<T>
extends AbstractOwbBean<T>
implements OwbInterceptor<T>

Defines the webbeans specific interceptors.

WebBeans interceotor classes has at least one InterceptorBinding annotation. It can be defined on the class or method level at the component. WebBeans interceptors are called after the EJB related interceptors are called in the chain. Semantics of the interceptors are specified by the EJB specificatin.

Version:
$Rev$ $Date$

Field Summary
 
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
WebBeansInterceptor(AbstractInjectionTargetBean<T> delegateBean)
           
 
Method Summary
 void addInterceptorBinding(Class<? extends Annotation> binding, Annotation annot)
          Add new binding type to the interceptor.
protected  T createInstance(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
          Creates the instance of the bean that has a specific implementation type.
 javax.enterprise.inject.spi.AnnotatedType<T> getAnnotatedType()
           
 Class<?> getBeanClass()
          Get return types of the bean.
 Class<?> getClazz()
          Gets the interceptor class.
 AbstractOwbBean<T> getDelegate()
           
 Set<javax.enterprise.inject.spi.InjectionPoint> getInjectionPoints()
          
 Set<Annotation> getInterceptorBindings()
           
 Set<javax.enterprise.inject.spi.Interceptor<?>> getMetaInceptors()
           
 String getName()
          Name of the bean.
 Set<Annotation> getQualifiers()
           
 Class<? extends Annotation> getScope()
           
 Set<Class<? extends Annotation>> getStereotypes()
          
 Set<Type> getTypes()
           
 boolean hasBinding(List<Class<? extends Annotation>> bindingTypes, List<Annotation> annots)
          Checks whether all of this interceptors binding types are present on the bean, with Nonbinding member values.
 Object intercept(javax.enterprise.inject.spi.InterceptionType type, T instance, javax.interceptor.InvocationContext ctx)
           
 boolean intercepts(javax.enterprise.inject.spi.InterceptionType type)
           
 boolean isAlternative()
          
 boolean isNullable()
          
 boolean isPassivationCapable()
          True if passivation capable false otherwise.
 boolean isSerializable()
          Returns true if bean is capable of serializable, false otherwise.
 void setClazz(Class<?> clazz)
          Sets interceptor class.
 void setInjections(Object proxy, javax.enterprise.context.spi.CreationalContext<?> creationalContext)
           
 String toString()
          
 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, destroyInstance, equals, getId, getImplQualifiers, getImplScopeType, getInjectionPoint, getLogger, getManager, getOwbStereotypes, getReturnType, getWebBeansContext, getWebBeansType, hashCode, isDependent, isEnabled, isSpecializedBean, setEnabled, setImplScopeType, setName, setNullable, setSerializable, setSpecializedBean
 
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
 

Constructor Detail

WebBeansInterceptor

public WebBeansInterceptor(AbstractInjectionTargetBean<T> delegateBean)
Method Detail

getDelegate

public AbstractOwbBean<T> getDelegate()
Specified by:
getDelegate in interface OwbInterceptor<T>

getAnnotatedType

public javax.enterprise.inject.spi.AnnotatedType<T> getAnnotatedType()
Specified by:
getAnnotatedType in interface OwbInterceptor<T>

addInterceptorBinding

public void addInterceptorBinding(Class<? extends Annotation> binding,
                                  Annotation annot)
Add new binding type to the interceptor.

Specified by:
addInterceptorBinding in interface OwbInterceptor<T>
Parameters:
binding - interceptor binding annotation. class
annot - binding type annotation

hasBinding

public boolean hasBinding(List<Class<? extends Annotation>> bindingTypes,
                          List<Annotation> annots)
Checks whether all of this interceptors binding types are present on the bean, with Nonbinding member values.

Specified by:
hasBinding in interface OwbInterceptor<T>
Parameters:
bindingTypes - binding types of bean
annots - binding types annots of bean
Returns:
true if all binding types of this interceptor exist ow false

getClazz

public Class<?> getClazz()
Gets the interceptor class.

Specified by:
getClazz in interface OwbInterceptor<T>
Returns:
interceptor class

getMetaInceptors

public Set<javax.enterprise.inject.spi.Interceptor<?>> getMetaInceptors()
Specified by:
getMetaInceptors in interface OwbInterceptor<T>

setClazz

public void setClazz(Class<?> clazz)
Sets interceptor class.

Specified by:
setClazz in interface OwbInterceptor<T>
Parameters:
clazz - class instance

getInterceptorBindings

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

createInstance

protected T createInstance(javax.enterprise.context.spi.CreationalContext<T> creationalContext)
Description copied from class: AbstractOwbBean
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

setInjections

public void setInjections(Object proxy,
                          javax.enterprise.context.spi.CreationalContext<?> creationalContext)
Specified by:
setInjections in interface OwbInterceptor<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>

getInjectionPoints

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

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

toString

public String toString()
Description copied from class: AbstractOwbBean

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

getBeanClass

public Class<?> getBeanClass()
Description copied from class: AbstractOwbBean
Get return types of the bean. As per section 11.1 it is defined as "returns the bean class of the managed bean or session bean or of the bean that declares the producer method or field." Which means in case of a producer field or method, we need to return the class where the producer field/method is defined in.

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>

intercept

public Object intercept(javax.enterprise.inject.spi.InterceptionType type,
                        T instance,
                        javax.interceptor.InvocationContext ctx)
Specified by:
intercept in interface javax.enterprise.inject.spi.Interceptor<T>

intercepts

public boolean intercepts(javax.enterprise.inject.spi.InterceptionType type)
Specified by:
intercepts in interface javax.enterprise.inject.spi.Interceptor<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>

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

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.