[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1312) Extend Compoent.initInterceptors to scan Annnotations on methods for additional interceptors
Chris Rudd (JIRA)
jira-events at lists.jboss.org
Wed May 9 18:32:54 EDT 2007
Extend Compoent.initInterceptors to scan Annnotations on methods for additional interceptors
--------------------------------------------------------------------------------------------
Key: JBSEAM-1312
URL: http://jira.jboss.com/jira/browse/JBSEAM-1312
Project: JBoss Seam
Issue Type: Feature Request
Components: Core
Affects Versions: 1.2.1.GA
Reporter: Chris Rudd
It would be nice if the Component.initInterceptors method not only scanned the annotations on the class for additional interceptors but also scanned the methods / fields for additional interceptors.
This would allow more flexability.
EG the @LoggedIn from the examples could be extended so that it checked for a class level or method level @LoggedIn annotation to instruct it to do the check (instead of only the class level as it is now). Naturally you would want to remove the class level annotation and only put it on the methods that require being logged in. BUT if you do that, the auto-magic initInterceptor code wont know to add the LoggedInInterceptor.
Altered initInterceptors:
private void initInterceptors()
{
initDefaultInterceptors();
findInterceptors(new AnnotatedElement[] { component.getBeanClass() });
for (Class clazz = component.getBeanClass(); clazz != Object.class; clazz = clazz
.getSuperclass())
{
findInterceptors(clazz.getDeclaredFields());
findInterceptors(clazz.getDeclaredMethods());
}
}
Additional support method :
protected void findInterceptors(AnnotatedElement[] aes)
{
for (AnnotatedElement ae : aes)
{
for (Annotation annotation : ae.getAnnotations())
{
if ( annotation.annotationType().isAnnotationPresent(INTERCEPTORS) )
{
Class[] classes = value( annotation.annotationType().getAnnotation(INTERCEPTORS) );
addInterceptor( new Interceptor(classes, annotation, this) );
}
if ( annotation.annotationType().isAnnotationPresent(Interceptors.class) )
{
Class[] classes = annotation.annotationType().getAnnotation(Interceptors.class).value();
addInterceptor( new Interceptor(classes, annotation, this) );
}
}
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list