[jboss-user] [JBoss AOP] - How to write pointcut ...

almirp do-not-reply at jboss.com
Fri Sep 21 09:13:00 EDT 2007


Hi to everybody :). I am currently in evaluating phase of JBoss AOP and already impressed with achievement you done so far. Now I'm stucked with one problem, I tried few things which didnt help, so I need to ask for help in this place.

I have class A whith structure like this

public class A {
  private String att1;
  private String att2;
  ...
  private B b1;
  private B b2;
}  

public class B {
  private String att1;
  private String att2;
  ...  
}

Now, I want to intercept setting of field B.att1, but cannot write pointcut like 

pointcut="set(private * B->att1)" 

because I need two different advices for setting A.b1.att1 and A.b2.att2.
Is there any way to write pointcut like this:

pointcut="set(private * A.b1->att1)"
pointcut="set(private * A.b2->att1)"

One possible alternative to this is :

pointcut="execution(public void A->setB1(..))"
pointcut="execution(public void A->setB2(..))"

but I'm more interested in other approaches, if there are any.

Thank you

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

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



More information about the jboss-user mailing list