[
http://jira.jboss.com/jira/browse/JBSEAM-1312?page=all ]
Chris Rudd reopened JBSEAM-1312:
--------------------------------
This not the same as JBSEAM-29. That is refereing to managing a seperate list of
interceptors by method, such that method A could have a different set of interceptors that
method B.
I am simply asking that the annotations found on fields and methods be consulted to add
additional class wide interceptors. A considerably smaller less complicated issue (as seen
by the code above that satisfies it).
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
Assigned To: Pete Muir
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