Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Use of introduced attributes/methods in around advices

Ooops... That won't work. Try this:

void around(Entity entity) : 
    execution(* Entity+.set*(..)) && this(entity) {
    entity.isDirty = true;
    proceed();
}

-Ramnivas

--- Ramnivas Laddad <ramnivas@xxxxxxxxx> wrote:
> Change your around() advice as follows:
> 
> void around(): execution(* Entity+.set*(..)) && this(entity) {
>     entity.isDirty = true;
>     proceed();
> }
> 
> -Ramnivas
> 
> 
> --- Ricardo Giacomin <ricardo.giacomin@xxxxxxxxxx> wrote:
> > The compiler message i get for the excerpt below is "isDirty cannot
> > be
> > resolved or is not a field".
> > 
> > public aspect DirtinessControlAspect
> > {
> >    interface Entity {}
> >    declare parents: uol.job.store.* implements Entity;
> > 
> >    private boolean Entity.isDirty = false;
> >    void around(): execution(* Entity+.set*(..))
> >    {
> >       this.isDirty = true;
> >       proceed();
> >    }
> > }
> > 
> > Any hints?
> > 
> > []s,
> > Ricardo.
> > 
> > ----- Original Message -----
> > From: "Shimon Rura" <shimon@xxxxxxxx>
> > To: "Ricardo Giacomin" <ricardo.giacomin@xxxxxxxxxx>
> > Cc: <aspectj-users@xxxxxxxxxxx>
> > Sent: Monday, March 31, 2003 8:07 PM
> > Subject: Re: [aspectj-users] Use of introduced attributes/methods
> in
> > around
> > advices
> > 
> > 
> > > You should be able to do what you want to do.  Could you post the
> > error
> > > message the compiler gives you along with the introduction code?
> > >
> > > shimon.
> > >
> > > On Mon, Mar 31, 2003 at 07:25:57PM -0300, Ricardo Giacomin wrote:
> > > > Hi all,
> > > >
> > > > Is it possible to use introduced attributes in around advices?
> > For
> > instance, suppose I have an aspect for keeping track of 'dirtiness'
> > of db
> > entities. The boolean isDirty attribute is introduced in my entity
> > classes
> > and I have an around() advice for all setters, which would mark
> this
> > flag as
> > true. The problem is that I get a compiler error saying that
> isDirty
> > cannot
> > be resolved or is not a field. If I keep isDirty as an aspect
> > attribute, and
> > not introduce it in the entity classes, there will be only one
> > isDirty for
> > all entities (which is not the intended behavior). What am I
> suppose
> > to do?
> > Define a perInstance aspect?
> > > >
> > > > Any help would be most appreciated.
> > > >
> > > > []s,
> > > > Ricardo.
> > 
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - File online, calculators, forms, and more
> http://platinum.yahoo.com
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://platinum.yahoo.com


Back to the top