[jboss-user] [JBoss AOP] - Ignore Field Access in Advice

lydiachung do-not-reply at jboss.com
Mon Jan 19 09:59:18 EST 2009


I wrote a very simple entity object which has a unique field called objectID.


  | public class CustomObject{
  |     public Long objectID;
  |     public String field1;
  |     public String field2;
  | }
  | 

And I have a field interceptor which intercepts all the field read and write requests.


  | public class CustomObjectFieldInterceptor{
  |     if(invocation instanceof FieldReadInvocation){
  |         FieldReadInvocation readInvocation = (FieldReadInvocation) invocation;
  |         CustomObject object1 = (CustomObject) readInvocation.getTarget();
  |         Long objID = object1.objectID;
  |     }
  | }
  | 

The last line inside the if block Long objID = object1.objectID; throws StackOverflowException because there is a recursive call. 

Is there a way to tell the interceptor not intercept the field access when the request is sent from its own method?

Thank you!



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

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



More information about the jboss-user mailing list