[jboss-user] [JBoss AOP] - Can't read parameter annotations through reflection

dwl8 do-not-reply at jboss.com
Sun Dec 3 19:46:51 EST 2006


I'm currently thinking about using JBoss AOP but i can't seem to get by this issue. I cannot read the parameter annotations of methods w/ a pointcut annotation. Here's the code i'm using:

jboss-aop.xml:

  | <aop>
  |    <aspect class="test.aop.aspects.LockAspect"/>
  | 
  |    <bind pointcut="all(@test.aop.annotations.WriteLock)">
  |       <advice name="writeLock" aspect="test.aop.aspects.LockAspect"/>
  |    </bind>
  | 
  |    <bind pointcut="all(@test.aop.annotations.ReadLock)">
  |       <advice name="readLock" aspect="test.aop.aspects.LockAspect"/>
  |    </bind>
  | </aop>
  | 

java code:

  | @ReadLock
  | public static People getPerson(@FirmId Integer firmId, Integer personId) {
  | 	return peopleMap.get(firmId).get(personId);
  | }
  | 

When i try to read the parameter annotation @FirmId through method.getParameterAnnotations() i get 0 length arrays for each param. When i change @ReadLock to, say, @Deprecated, I can read the parameter annotation correctly. I'm wondering if the loadtime byte code weaving(?) is doing something to the annotation. Any help is greatly appreciated. I'm pretty new to this stuff so i may be missing something obvious...

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3990838#3990838

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3990838



More information about the jboss-user mailing list