org.apache.webbeans.intercept
Class InterceptorUtil

java.lang.Object
  extended by org.apache.webbeans.intercept.InterceptorUtil

public final class InterceptorUtil
extends Object


Method Summary
static Object callAroundInvokes(InjectionTargetBean<?> bean, Object instance, CreationalContextImpl<?> creationalContext, Method proceed, Object[] arguments, List<InterceptorData> stack, InvocationContext ejbInvocationContext, Object altKey)
           
static
<T> void
checkAnnotatedTypeInterceptorConditions(AnnotatedType<T> annotatedType)
           
static boolean checkGivenClassIsInInterceptorList(Class<?> mainClass, Class<?> candidateClass)
          Return true if given candidate is listed in interceptors list.
static boolean checkInInterceptorHierarchy(Class<?> interceptorClass, Class<?> candidateClass)
          Return true if candidate class is a super class of given interceptor class.
static void checkInterceptorConditions(Class<?> clazz)
           
static
<T> void
checkLifecycleConditions(AnnotatedType<T> annotatedType, Annotation[] annots, String errorMessage)
           
static
<T> void
checkLifecycleConditions(Class<T> clazz, Annotation[] annots, String errorMessage)
           
static void checkSimpleWebBeansInterceptorConditions(Class<?> clazz)
           
static void filterCommonInterceptorStackList(List<InterceptorData> stack, Method method)
          Filter bean interceptor stack.
static void filterOverridenAroundInvokeInterceptor(Class<?> beanClass, List<InterceptorData> stack)
          If an AroundInvoke method is overridden by another method (regardless of whether that method is itself an AroundInvoke method), it will not be invoked.
static void filterOverridenLifecycleInterceptor(Class<?> beanClass, List<InterceptorData> stack)
          Remove bean inherited and overriden lifecycle interceptor method from its stack list.
static Class<? extends Annotation> getInterceptorAnnotationClazz(InterceptionType type)
           
static List<InterceptorData> getInterceptorMethods(List<InterceptorData> stack, InterceptorType type)
          Gets list of interceptors with the given type.
static
<T> boolean
isBusinessMethodInterceptor(AnnotatedType<T> annotatedType)
           
static boolean isBusinessMethodInterceptor(Class<?> clazz)
           
static
<T> boolean
isLifecycleMethodInterceptor(AnnotatedType<T> annotatedType)
           
static boolean isLifecycleMethodInterceptor(Class<?> clazz)
           
static boolean isWebBeansBusinessMethod(Method method)
          Check if the given method is a 'business method' in the sense of the Interceptor specification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isWebBeansBusinessMethod

public static boolean isWebBeansBusinessMethod(Method method)
Check if the given method is a 'business method' in the sense of the Interceptor specification

Parameters:
method -
Returns:
true if the given method is an interceptable business method

getInterceptorAnnotationClazz

public static Class<? extends Annotation> getInterceptorAnnotationClazz(InterceptionType type)

isBusinessMethodInterceptor

public static <T> boolean isBusinessMethodInterceptor(AnnotatedType<T> annotatedType)

isBusinessMethodInterceptor

public static boolean isBusinessMethodInterceptor(Class<?> clazz)

isLifecycleMethodInterceptor

public static boolean isLifecycleMethodInterceptor(Class<?> clazz)

isLifecycleMethodInterceptor

public static <T> boolean isLifecycleMethodInterceptor(AnnotatedType<T> annotatedType)

checkAnnotatedTypeInterceptorConditions

public static <T> void checkAnnotatedTypeInterceptorConditions(AnnotatedType<T> annotatedType)

checkInterceptorConditions

public static void checkInterceptorConditions(Class<?> clazz)

checkLifecycleConditions

public static <T> void checkLifecycleConditions(Class<T> clazz,
                                                Annotation[] annots,
                                                String errorMessage)

checkLifecycleConditions

public static <T> void checkLifecycleConditions(AnnotatedType<T> annotatedType,
                                                Annotation[] annots,
                                                String errorMessage)

checkSimpleWebBeansInterceptorConditions

public static void checkSimpleWebBeansInterceptorConditions(Class<?> clazz)

getInterceptorMethods

public static List<InterceptorData> getInterceptorMethods(List<InterceptorData> stack,
                                                          InterceptorType type)
Gets list of interceptors with the given type.

Parameters:
stack - interceptor stack
type - interceptor type
Returns:
list of interceptor

filterCommonInterceptorStackList

public static void filterCommonInterceptorStackList(List<InterceptorData> stack,
                                                    Method method)
Filter bean interceptor stack.

Parameters:
stack - interceptor stack
method - called method on proxy
ownerCreationalContext - bean creational context

callAroundInvokes

public static Object callAroundInvokes(InjectionTargetBean<?> bean,
                                       Object instance,
                                       CreationalContextImpl<?> creationalContext,
                                       Method proceed,
                                       Object[] arguments,
                                       List<InterceptorData> stack,
                                       InvocationContext ejbInvocationContext,
                                       Object altKey)
                                throws Exception
Throws:
Exception

checkInInterceptorHierarchy

public static boolean checkInInterceptorHierarchy(Class<?> interceptorClass,
                                                  Class<?> candidateClass)
Return true if candidate class is a super class of given interceptor class.

Parameters:
interceptorClass - interceptor class
candidateClass - candaite class
Returns:
true if candidate class is a super class of given interceptor class

filterOverridenLifecycleInterceptor

public static void filterOverridenLifecycleInterceptor(Class<?> beanClass,
                                                       List<InterceptorData> stack)
Remove bean inherited and overriden lifecycle interceptor method from its stack list.

Parameters:
clazz - bean class
stack - bean interceptor stack

filterOverridenAroundInvokeInterceptor

public static void filterOverridenAroundInvokeInterceptor(Class<?> beanClass,
                                                          List<InterceptorData> stack)
If an AroundInvoke method is overridden by another method (regardless of whether that method is itself an AroundInvoke method), it will not be invoked. Remove bean inherited but overriden around invoke interceptor method from its stack list.

Parameters:
clazz - bean class
stack - bean interceptor stack

checkGivenClassIsInInterceptorList

public static boolean checkGivenClassIsInInterceptorList(Class<?> mainClass,
                                                         Class<?> candidateClass)
Return true if given candidate is listed in interceptors list.

Parameters:
mainClass - bean class
candidateClass - interceptor candidate class
Returns:
true if given candidate is listed in interceptors list


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