org.objectweb.easybeans.deployment.annotations.helper.bean
Class InterceptorsClassResolver

java.lang.Object
  extended by org.objectweb.easybeans.deployment.annotations.helper.bean.InterceptorsClassResolver

public final class InterceptorsClassResolver
extends java.lang.Object

This class sets the EasyBeans interceptors used when invoking business methods and also for life cycle events.

Author:
Florent Benoit

Field Summary
private static JMethod EASYBEANS_INTERCEPTOR
          Signature of EasyBeans interceptors.
 
Constructor Summary
private InterceptorsClassResolver()
          Helper class, no public constructor.
 
Method Summary
private static void addOnlyIfNotPresent(java.util.List<JClassInterceptor> interceptors, JClassInterceptor jInterceptor)
          Adds in the given interceptors list the interceptor object.
private static java.util.Map<InterceptorType,java.util.List<JClassInterceptor>> getInterceptors(java.lang.String referencingName, EjbJarAnnotationMetadata ejbJarAnnotationMetadata, java.util.List<java.lang.String> interceptorsClasses)
          Found interceptors method in the given class.
private static java.util.LinkedList<ClassAnnotationMetadata> getInvertedSuperClassesMetadata(ClassAnnotationMetadata classAnnotationMetadata)
          Gets the inverted list of metadata for a given class (super class is the first one in the list).
static void resolve(ClassAnnotationMetadata classAnnotationMetadata)
          Found all interceptors of the class (including business and lifecycle events) and also set EasyBeans interceptors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EASYBEANS_INTERCEPTOR

private static final JMethod EASYBEANS_INTERCEPTOR
Signature of EasyBeans interceptors.

Constructor Detail

InterceptorsClassResolver

private InterceptorsClassResolver()
Helper class, no public constructor.

Method Detail

resolve

public static void resolve(ClassAnnotationMetadata classAnnotationMetadata)
                    throws ResolverException
Found all interceptors of the class (including business and lifecycle events) and also set EasyBeans interceptors.

Parameters:
classAnnotationMetadata - class to analyze
Throws:
ResolverException - if metadata is missing

getInterceptors

private static java.util.Map<InterceptorType,java.util.List<JClassInterceptor>> getInterceptors(java.lang.String referencingName,
                                                                                                EjbJarAnnotationMetadata ejbJarAnnotationMetadata,
                                                                                                java.util.List<java.lang.String> interceptorsClasses)
                                                                                         throws ResolverException
Found interceptors method in the given class. It will analyze each interceptor class and fill a structure with a mapping between the annotation type and the corresponding interceptors.

Parameters:
referencingName - name of the class/method that reference these interceptors
ejbJarAnnotationMetadata - root of all annotations (used to find the metadata)
interceptorsClasses - list of classes that contains interceptors
Returns:
the map between the type of interceptor (PostConstrut, AroundInvoke, ...) and the JClassInterceptor objects
Throws:
ResolverException - if analyze fails

addOnlyIfNotPresent

private static void addOnlyIfNotPresent(java.util.List<JClassInterceptor> interceptors,
                                        JClassInterceptor jInterceptor)
Adds in the given interceptors list the interceptor object. If the object is already present in the list, doesn't add it again.

Parameters:
interceptors - the list of interceptors.
jInterceptor - the interceptor to add.

getInvertedSuperClassesMetadata

private static java.util.LinkedList<ClassAnnotationMetadata> getInvertedSuperClassesMetadata(ClassAnnotationMetadata classAnnotationMetadata)
Gets the inverted list of metadata for a given class (super class is the first one in the list).

Parameters:
classAnnotationMetadata - the class to analyze
Returns:
the given list