[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [aspectj-users] what for args pointcut designator?
- From: "Wes" <wes@xxxxxxxxxxxxxx>
- Date: Sat, 2 Sep 2006 22:29:21 -0700
- Delivered-to: email@example.com
this(), args(), and target() allow you to bind variables in a type-safe way and to do runtime tests.
void put(Object key, Object value)
you might want to pick out only join points with keys of type foo:
execution(void put(Object, Object)) && args(Foo, Object)
If you were to do something with it (e.g., put Foo in a wrapper with a better hashcode), then you'd want to bind the variable. Without binding (i.e., using reflection) you only get Object, which makes for a lot of runtime ClassCastException.
> ------------Original Message------------
> From: Kamil Dworakowski <kamil.dworakowski@xxxxxxxxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Sat, Sep-2-2006 11:51 AM
> Subject: [aspectj-users] what for args pointcut designator?
> What is the most important reason for having args pointcut designator
> aspectj language? I would prefer exposing args in signature like this
> aPointcut(int i): execution( * *.method( int i ) );
> The one thing that comes to my mind is
> execution( * *.meth( Object) ) && args( String )
> That is, however, not an everyday use and can be achieved by type
> checking in the advice body.
> The reason I go through it is because I want to implement aspectj like
> aop. I mean a reasonable subset. I wonder if I could just forget about
> aspectj-users mailing list