org.objectweb.easybeans.deployment.annotations.metadata
Class ClassAnnotationMetadata

java.lang.Object
  extended by org.objectweb.easybeans.deployment.annotations.metadata.ClassAnnotationMetadata
All Implemented Interfaces:
IAnnotationEJB, IAnnotationResource, IEJBInterceptors, ITransactionAttribute

public class ClassAnnotationMetadata
extends java.lang.Object
implements ITransactionAttribute, IAnnotationEJB, IAnnotationResource, IEJBInterceptors

This class represents the annotation metadata of a Bean.
From this class, we can access to all methods of a bean with its associated information.

Author:
Florent Benoit

Field Summary
private  JInterceptors annotationInterceptors
          List of annotation interceptors.
private  ApplicationException applicationException
          Application exception annotation.
private  MethodAnnotationMetadata aroundInvokeMethodMetadata
          Method used for @AroundInvoke on this class (only one per class).
private  java.lang.String className
          Name of the class associated to this metadata.
private  ClassType classType
          The type of the class.
private  EjbJarAnnotationMetadata ejbJarAnnotationMetadata
          Parent meta data.
private  java.util.Map<JField,FieldAnnotationMetadata> fieldsAnnotationMetadata
          List of field annotations metadata.
private  java.util.List<JClassInterceptor> globalEasyBeansInterceptors
          EasyBeans global interceptors.
These interceptors correspond to a list of interceptors that need to be present first on all methods.
private  java.lang.String[] interfaces
          Interfaces of this clas.
private  JAnnotationEJB jAnnotationEJB
          Object representing @EJB annotation.
private  java.util.List<JAnnotationEJB> jAnnotationEJBs
          Object representing @EJBs annotation.
private  JAnnotationResource jAnnotationResource
          Object representing @Resource annotation.
private  java.util.List<JAnnotationResource> jAnnotationResources
          Object representing @Resources annotation.
private  JLocal jLocal
          List of local interfaces.
private  JMessageDriven jMessageDriven
          Message Driven attribute.
private  JRemote jRemote
          List of remote interfaces.
private  java.lang.String localHome
          Local Home.
private static JLog logger
          Logger.
private  java.util.Map<JMethod,MethodAnnotationMetadata> methodsAnnotationMetadata
          List of method annotations metadata.
private  MethodAnnotationMetadata postActivateMethodMetadata
          Method used for @PostActivate on this class (only one per class).
private  MethodAnnotationMetadata postConstructMethodMetadata
          Method used for @PostConstruct on this class (only one per class).
private  MethodAnnotationMetadata preDestroyMethodMetadata
          Method used for @PreDestroy on this class (only one per class).
private  MethodAnnotationMetadata prePassivateMethodMetadata
          Method used for @PrePassivate on this class (only one per class).
private  java.lang.String remoteHome
          Remote Home.
private  java.lang.String superName
          Superclass name.
private  TransactionAttributeType transactionAttributeType
          Transaction attribute type (default = required).
private  TransactionManagementType transactionManagementType
          Transaction management type (default = container).
private  java.lang.String unQualifiedBeanName
          Unqualified name of the bean.
private  java.util.Map<InterceptorType,java.util.List<JClassInterceptor>> userInterceptors
          User interceptors.
 
Constructor Summary
ClassAnnotationMetadata(java.lang.String className, EjbJarAnnotationMetadata ejbJarAnnotationMetadata)
          Constructor.
 
Method Summary
 void addFieldAnnotationMetadata(FieldAnnotationMetadata fieldAnnotationMetadata)
          Add field annotation metadata for a given Bean.
 void addMethodAnnotationMetadata(MethodAnnotationMetadata methodAnnotationMetadata)
          Add method annotation metadata for a given Bean.
private static void concatStringBuilder(java.lang.String name, java.lang.Object object, java.lang.StringBuilder sb)
          Adds an entry to the given StringBuilder.
 JInterceptors getAnnotationInterceptors()
           
 ApplicationException getApplicationException()
           
 MethodAnnotationMetadata getAroundInvokeMethodMetadata()
           
 java.lang.String getClassName()
           
 EjbJarAnnotationMetadata getEjbJarAnnotationMetadata()
           
 FieldAnnotationMetadata getFieldAnnotationMetadata(JField jField)
           
 java.util.Collection<FieldAnnotationMetadata> getFieldAnnotationMetadataCollection()
          Get collections of fields annotation metadata.
 java.util.List<JClassInterceptor> getGlobalEasyBeansInterceptors()
           
 java.lang.String[] getInterfaces()
           
 JAnnotationEJB getJAnnotationEJB()
           
 java.util.List<JAnnotationEJB> getJAnnotationEJBs()
           
 JAnnotationResource getJAnnotationResource()
           
 java.util.List<JAnnotationResource> getJAnnotationResources()
           
 JMessageDriven getJMessageDriven()
           
 java.lang.String getLocalHome()
           
 JLocal getLocalInterfaces()
           
 MethodAnnotationMetadata getMethodAnnotationMetadata(JMethod jMethod)
           
 java.util.Collection<MethodAnnotationMetadata> getMethodAnnotationMetadataCollection()
          Get collections of methods annotation metadata.
 MethodAnnotationMetadata getPostActivateMethodMetadata()
           
 MethodAnnotationMetadata getPostConstructMethodMetadata()
           
 MethodAnnotationMetadata getPreDestroyMethodMetadata()
           
 MethodAnnotationMetadata getPrePassivateMethodMetadata()
           
 java.lang.String getRemoteHome()
           
 JRemote getRemoteInterfaces()
           
 java.lang.String getSuperName()
           
 TransactionAttributeType getTransactionAttributeType()
           
 TransactionManagementType getTransactionManagementType()
           
 java.lang.String getUnQualifiedBeanName()
           
 java.util.Map<InterceptorType,java.util.List<JClassInterceptor>> getUserEasyBeansInterceptors()
           
 boolean isBean()
           
 boolean isInterceptor()
          Is that this class is an interceptor class ?
 boolean isMdb()
           
 boolean isSession()
           
 boolean isStateful()
           
 boolean isStateless()
           
 void setAnnotationsInterceptors(JInterceptors annotationInterceptors)
          Sets the object representing the @Interceptors annotation.
 void setApplicationException(ApplicationException applicationException)
          Sets the object representing the @ApplicationException annotation.
 void setAroundInvokeMethodMetadata(MethodAnnotationMetadata aroundInvokeMethodMetadata)
          Sets the@AroundInvoke method of this class.
 void setClassType(ClassType cType)
          Sets the type of this class.
 void setGlobalEasyBeansInterceptors(java.util.List<JClassInterceptor> globalEasyBeansInterceptors)
          Sets the list of global interceptors that enhancers will use.
 void setInterfaces(java.lang.String[] interfaces)
          Sets the interfaces of this class.
 void setJAnnotationEJB(JAnnotationEJB jAnnotationEJB)
          Set JAnnotationEJB object.
 void setJAnnotationEJBs(java.util.List<JAnnotationEJB> jAnnotationEJBs)
          Set JAnnotationEJBs object.
 void setJAnnotationResource(JAnnotationResource jAnnotationResource)
          Set JAnnotationResource object.
 void setJAnnotationResources(java.util.List<JAnnotationResource> jAnnotationResources)
          Set JAnnotationResources object.
 void setJMessageDriven(JMessageDriven messageDriven)
          Sets the message driven bean object.
 void setLocalHome(java.lang.String localHome)
          Sets the @LocalHome class name.
 void setLocalInterfaces(JLocal jLocal)
          Sets the local interfaces of this class.
 void setPostActivateMethodMetadata(MethodAnnotationMetadata postActivateMethodMetadata)
          Sets the@PostActivate method of this class.
 void setPostConstructMethodMetadata(MethodAnnotationMetadata postConstructMethodMetadata)
          Sets the@PostConstruct method of this class.
 void setPreDestroyMethodMetadata(MethodAnnotationMetadata preDestroyMethodMetadata)
          Sets the@PreDestroy method of this class.
 void setPrePassivateMethodMetadata(MethodAnnotationMetadata prePassivateMethodMetadata)
          Sets the@PrePassivate method of this class.
 void setRemoteHome(java.lang.String remoteHome)
          Sets the @RemoteHome class name.
 void setRemoteInterfaces(JRemote jRemote)
          Sets the remote interfaces of this class.
 void setSuperName(java.lang.String superName)
          Sets the super class name.
 void setTransactionAttributeType(TransactionAttributeType transactionAttributeType)
          Set Transaction Attribute Type.
 void setTransactionManagementType(TransactionManagementType transactionManagementType)
          Sets transaction management type.
 void setUnQualifiedBeanName(java.lang.String beanName)
          Sets the name of the bean (based on @Stateless anotation for example).
 void setUserInterceptors(java.util.Map<InterceptorType,java.util.List<JClassInterceptor>> userInterceptors)
          Sets the list of user interceptors that enhancers will use.
These interceptors are defined in bean class.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

private static JLog logger
Logger.


methodsAnnotationMetadata

private java.util.Map<JMethod,MethodAnnotationMetadata> methodsAnnotationMetadata
List of method annotations metadata.


fieldsAnnotationMetadata

private java.util.Map<JField,FieldAnnotationMetadata> fieldsAnnotationMetadata
List of field annotations metadata.


ejbJarAnnotationMetadata

private EjbJarAnnotationMetadata ejbJarAnnotationMetadata
Parent meta data.


unQualifiedBeanName

private java.lang.String unQualifiedBeanName
Unqualified name of the bean.


jLocal

private JLocal jLocal
List of local interfaces.


jRemote

private JRemote jRemote
List of remote interfaces.


jMessageDriven

private JMessageDriven jMessageDriven
Message Driven attribute.


localHome

private java.lang.String localHome
Local Home.


remoteHome

private java.lang.String remoteHome
Remote Home.


annotationInterceptors

private JInterceptors annotationInterceptors
List of annotation interceptors.


globalEasyBeansInterceptors

private java.util.List<JClassInterceptor> globalEasyBeansInterceptors
EasyBeans global interceptors.
These interceptors correspond to a list of interceptors that need to be present first on all methods.


userInterceptors

private java.util.Map<InterceptorType,java.util.List<JClassInterceptor>> userInterceptors
User interceptors. These interceptors correspond to a list of Interceptor that user has specified in its bean class. Map<interceptor type <--> List of methods/class corresponding to the interceptor>


transactionManagementType

private TransactionManagementType transactionManagementType
Transaction management type (default = container).


transactionAttributeType

private TransactionAttributeType transactionAttributeType
Transaction attribute type (default = required).


applicationException

private ApplicationException applicationException
Application exception annotation.


superName

private java.lang.String superName
Superclass name.


interfaces

private java.lang.String[] interfaces
Interfaces of this clas.


classType

private ClassType classType
The type of the class.

See Also:
ClassType

className

private java.lang.String className
Name of the class associated to this metadata.


aroundInvokeMethodMetadata

private MethodAnnotationMetadata aroundInvokeMethodMetadata
Method used for @AroundInvoke on this class (only one per class).


jAnnotationEJB

private JAnnotationEJB jAnnotationEJB
Object representing @EJB annotation.


jAnnotationEJBs

private java.util.List<JAnnotationEJB> jAnnotationEJBs
Object representing @EJBs annotation.


jAnnotationResource

private JAnnotationResource jAnnotationResource
Object representing @Resource annotation.


jAnnotationResources

private java.util.List<JAnnotationResource> jAnnotationResources
Object representing @Resources annotation.


postConstructMethodMetadata

private MethodAnnotationMetadata postConstructMethodMetadata
Method used for @PostConstruct on this class (only one per class).


preDestroyMethodMetadata

private MethodAnnotationMetadata preDestroyMethodMetadata
Method used for @PreDestroy on this class (only one per class).


postActivateMethodMetadata

private MethodAnnotationMetadata postActivateMethodMetadata
Method used for @PostActivate on this class (only one per class).


prePassivateMethodMetadata

private MethodAnnotationMetadata prePassivateMethodMetadata
Method used for @PrePassivate on this class (only one per class).

Constructor Detail

ClassAnnotationMetadata

public ClassAnnotationMetadata(java.lang.String className,
                               EjbJarAnnotationMetadata ejbJarAnnotationMetadata)
Constructor.

Parameters:
className - name of the class associated to these metadatas.
ejbJarAnnotationMetadata - parent metadata object.
Method Detail

getClassName

public java.lang.String getClassName()
Returns:
name of the bean (associated to this metadata).

addMethodAnnotationMetadata

public void addMethodAnnotationMetadata(MethodAnnotationMetadata methodAnnotationMetadata)
Add method annotation metadata for a given Bean.

Parameters:
methodAnnotationMetadata - metadata of a method.

getMethodAnnotationMetadata

public MethodAnnotationMetadata getMethodAnnotationMetadata(JMethod jMethod)
Parameters:
jMethod - key of the map of methods annotations.
Returns:
method annotation metadata of a given method.

getMethodAnnotationMetadataCollection

public java.util.Collection<MethodAnnotationMetadata> getMethodAnnotationMetadataCollection()
Get collections of methods annotation metadata.

Returns:
collections of methods annotation metadata.

addFieldAnnotationMetadata

public void addFieldAnnotationMetadata(FieldAnnotationMetadata fieldAnnotationMetadata)
Add field annotation metadata for a given Bean.

Parameters:
fieldAnnotationMetadata - metadata of a field.

getFieldAnnotationMetadata

public FieldAnnotationMetadata getFieldAnnotationMetadata(JField jField)
Parameters:
jField - key of the map of fields annotations.
Returns:
field annotation metadata of a given method.

getFieldAnnotationMetadataCollection

public java.util.Collection<FieldAnnotationMetadata> getFieldAnnotationMetadataCollection()
Get collections of fields annotation metadata.

Returns:
collections of fields annotation metadata.

setLocalInterfaces

public void setLocalInterfaces(JLocal jLocal)
Sets the local interfaces of this class.

Parameters:
jLocal - list of interfaces.

setRemoteInterfaces

public void setRemoteInterfaces(JRemote jRemote)
Sets the remote interfaces of this class.

Parameters:
jRemote - list of interfaces.

getLocalInterfaces

public JLocal getLocalInterfaces()
Returns:
the local interfaces of this class.

getRemoteInterfaces

public JRemote getRemoteInterfaces()
Returns:
the remote interfaces of this class.

getUnQualifiedBeanName

public java.lang.String getUnQualifiedBeanName()
Returns:
unqualified name of the bean.

setUnQualifiedBeanName

public void setUnQualifiedBeanName(java.lang.String beanName)
Sets the name of the bean (based on @Stateless anotation for example).

Parameters:
beanName - unqualified bean name

isStateless

public boolean isStateless()
Returns:
true if the class is a stateless class

isStateful

public boolean isStateful()
Returns:
true if the class is a stateful class

isSession

public boolean isSession()
Returns:
true if the class is a session bean class

isMdb

public boolean isMdb()
Returns:
true if the class is an MDB class

setClassType

public void setClassType(ClassType cType)
Sets the type of this class.

Parameters:
cType - a type from enum class ClassType.
See Also:
ClassType

getJMessageDriven

public JMessageDriven getJMessageDriven()
Returns:
Message driven attribute.

setJMessageDriven

public void setJMessageDriven(JMessageDriven messageDriven)
Sets the message driven bean object.

Parameters:
messageDriven - attributes of message driven bean.

concatStringBuilder

private static void concatStringBuilder(java.lang.String name,
                                        java.lang.Object object,
                                        java.lang.StringBuilder sb)
Adds an entry to the given StringBuilder.

Parameters:
name - the name of the entry.
object - object to add.
sb - the string builder object on which add the given element.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
string representation.

getRemoteHome

public java.lang.String getRemoteHome()
Returns:
the @RemoteHome class name.

setRemoteHome

public void setRemoteHome(java.lang.String remoteHome)
Sets the @RemoteHome class name.

Parameters:
remoteHome - the class name.

getLocalHome

public java.lang.String getLocalHome()
Returns:
the @LocalHome class name.

setLocalHome

public void setLocalHome(java.lang.String localHome)
Sets the @LocalHome class name.

Parameters:
localHome - the class name.

getTransactionManagementType

public TransactionManagementType getTransactionManagementType()
Returns:
transaction management type from @see TransactionManagementType.

setTransactionManagementType

public void setTransactionManagementType(TransactionManagementType transactionManagementType)
Sets transaction management type.

Parameters:
transactionManagementType - value. (BEAN, CONTAINER)
See Also:
TransactionManagementType

getTransactionAttributeType

public TransactionAttributeType getTransactionAttributeType()
Specified by:
getTransactionAttributeType in interface ITransactionAttribute
Returns:
transaction Attribute type.
See Also:
TransactionAttributeType

setTransactionAttributeType

public void setTransactionAttributeType(TransactionAttributeType transactionAttributeType)
Set Transaction Attribute Type.

Specified by:
setTransactionAttributeType in interface ITransactionAttribute
Parameters:
transactionAttributeType - the type of transaction.
See Also:
TransactionAttributeType

getAnnotationInterceptors

public JInterceptors getAnnotationInterceptors()
Returns:
object representing list of @Interceptors.

setAnnotationsInterceptors

public void setAnnotationsInterceptors(JInterceptors annotationInterceptors)
Sets the object representing the @Interceptors annotation.

Specified by:
setAnnotationsInterceptors in interface IEJBInterceptors
Parameters:
annotationInterceptors - list of classes

getApplicationException

public ApplicationException getApplicationException()
Returns:
the @ApplicationException annotation.

setApplicationException

public void setApplicationException(ApplicationException applicationException)
Sets the object representing the @ApplicationException annotation.

Parameters:
applicationException - object representation

isBean

public boolean isBean()
Returns:
true if the classs is a Bean

getInterfaces

public java.lang.String[] getInterfaces()
Returns:
array of interfaces name.

setInterfaces

public void setInterfaces(java.lang.String[] interfaces)
Sets the interfaces of this class.

Parameters:
interfaces - name of interfaces.

getSuperName

public java.lang.String getSuperName()
Returns:
the super class name.

setSuperName

public void setSuperName(java.lang.String superName)
Sets the super class name.

Parameters:
superName - name of the super class.

getEjbJarAnnotationMetadata

public EjbJarAnnotationMetadata getEjbJarAnnotationMetadata()
Returns:
parent metadata object.

getUserEasyBeansInterceptors

public java.util.Map<InterceptorType,java.util.List<JClassInterceptor>> getUserEasyBeansInterceptors()
Returns:
Map<interceptor type <--> List of methods/class corresponding to the interceptor> of user interceptors that enhancer will use.

setUserInterceptors

public void setUserInterceptors(java.util.Map<InterceptorType,java.util.List<JClassInterceptor>> userInterceptors)
Sets the list of user interceptors that enhancers will use.
These interceptors are defined in bean class.

Parameters:
userInterceptors - list of interceptors that enhancer will use.

getGlobalEasyBeansInterceptors

public java.util.List<JClassInterceptor> getGlobalEasyBeansInterceptors()
Returns:
list of global interceptors that enhancer will use. (ie : ENC)

setGlobalEasyBeansInterceptors

public void setGlobalEasyBeansInterceptors(java.util.List<JClassInterceptor> globalEasyBeansInterceptors)
Sets the list of global interceptors that enhancers will use.

Parameters:
globalEasyBeansInterceptors - list of interceptors that enhancer will use.

getAroundInvokeMethodMetadata

public MethodAnnotationMetadata getAroundInvokeMethodMetadata()
Returns:
the method metadata with annotation @AroundInvoke.

setAroundInvokeMethodMetadata

public void setAroundInvokeMethodMetadata(MethodAnnotationMetadata aroundInvokeMethodMetadata)
Sets the@AroundInvoke method of this class.

Parameters:
aroundInvokeMethodMetadata - the method.

getPostConstructMethodMetadata

public MethodAnnotationMetadata getPostConstructMethodMetadata()
Returns:
the method metadata with annotation @PostConstruct.

setPostConstructMethodMetadata

public void setPostConstructMethodMetadata(MethodAnnotationMetadata postConstructMethodMetadata)
Sets the@PostConstruct method of this class.

Parameters:
postConstructMethodMetadata - the method.

getPreDestroyMethodMetadata

public MethodAnnotationMetadata getPreDestroyMethodMetadata()
Returns:
the method metadata with annotation @PreDestroy.

setPreDestroyMethodMetadata

public void setPreDestroyMethodMetadata(MethodAnnotationMetadata preDestroyMethodMetadata)
Sets the@PreDestroy method of this class.

Parameters:
preDestroyMethodMetadata - the method.

getPostActivateMethodMetadata

public MethodAnnotationMetadata getPostActivateMethodMetadata()
Returns:
the method metadata with annotation @PostActivate.

setPostActivateMethodMetadata

public void setPostActivateMethodMetadata(MethodAnnotationMetadata postActivateMethodMetadata)
Sets the@PostActivate method of this class.

Parameters:
postActivateMethodMetadata - the method.

getPrePassivateMethodMetadata

public MethodAnnotationMetadata getPrePassivateMethodMetadata()
Returns:
the method metadata with annotation @PrePassivate.

setPrePassivateMethodMetadata

public void setPrePassivateMethodMetadata(MethodAnnotationMetadata prePassivateMethodMetadata)
Sets the@PrePassivate method of this class.

Parameters:
prePassivateMethodMetadata - the method.

isInterceptor

public boolean isInterceptor()
Is that this class is an interceptor class ?

Returns:
true if it the case, else false.

getJAnnotationEJB

public JAnnotationEJB getJAnnotationEJB()
Specified by:
getJAnnotationEJB in interface IAnnotationEJB
Returns:
JAnnotationEJB object representing javax.annotation.EJB annotation.

setJAnnotationEJB

public void setJAnnotationEJB(JAnnotationEJB jAnnotationEJB)
Set JAnnotationEJB object.

Specified by:
setJAnnotationEJB in interface IAnnotationEJB
Parameters:
jAnnotationEJB - object representing javax.annotation.EJB annotation.

getJAnnotationEJBs

public java.util.List<JAnnotationEJB> getJAnnotationEJBs()
Returns:
JAnnotationEJBs list representing @EJBs annotation.

setJAnnotationEJBs

public void setJAnnotationEJBs(java.util.List<JAnnotationEJB> jAnnotationEJBs)
Set JAnnotationEJBs object.

Parameters:
jAnnotationEJBs - list representing javax.annotation.EJBs annotation.

getJAnnotationResource

public JAnnotationResource getJAnnotationResource()
Specified by:
getJAnnotationResource in interface IAnnotationResource
Returns:
JAnnotationResource object representing javax.annotation.Resource annotation.

setJAnnotationResource

public void setJAnnotationResource(JAnnotationResource jAnnotationResource)
Set JAnnotationResource object.

Specified by:
setJAnnotationResource in interface IAnnotationResource
Parameters:
jAnnotationResource - object representing javax.annotation.Resource annotation.

getJAnnotationResources

public java.util.List<JAnnotationResource> getJAnnotationResources()
Returns:
JAnnotationResources list representing @Resources annotation.

setJAnnotationResources

public void setJAnnotationResources(java.util.List<JAnnotationResource> jAnnotationResources)
Set JAnnotationResources object.

Parameters:
jAnnotationResources - list representing javax.annotation.Resources annotation.