Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] only advise an object when its used in certain application scenarios

Robert,

You would need to use a cflow pointcut.  See
http://www.eclipse.org/aspectj/doc/released/progguide/quick.html#quick-pointcuts

You would want to do something like this:

pointcut uiTier() : within(com.foo.bar.ui..*);

pointcut personStuff() : within(Person);

before() : cflow(uiTier()) && personStuff() {  ... }

On Sun, Sep 20, 2009 at 7:09 PM, Robert Taylor <rtaylor@xxxxxxxxxxxxxx> wrote:
> Greetings,
>
> I need to advise the same object only in certain scenarios of an
> application.
>
> For example,
> I have a model object, say Person.
>
> I use Hibernate to persist and retrieve Person objects.
>
> I do not want to advise certain getter/setter methods on Person, when it
> is in control of Hibernate framework.
>
> However, I do want to advise those getter/setter methods on Person when it
> is used in the UI tier. Essentially when the UI components retrieve
> information from
> Person or the UI components populate Person with information.
>
> I'm not sure how to define my point cuts for this situation (if it can be
> done).
>
> /robert
>
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top