[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [aspectj-users] what for args pointcut designator?
- From: "Ron DiFrango" <rdifrango@xxxxxxxxxxxxxxxxxxx>
- Date: Sun, 3 Sep 2006 10:14:27 -0400
- Delivered-to: firstname.lastname@example.org
- Thread-index: AcbPPVyVndsl2q3xQ9y/vGLUy3r0/AAJeeAT
- Thread-topic: [aspectj-users] what for args pointcut designator?
I am not sure what you mean by "most important reason", but what Wes points out is the REASON. And it is a slight bit inflammatory if you ask me.
now onto the question, the args designation allows you to limit your join points in such a way that only those points that have the specific args are matched which is a compile or Load Time check. If you do not specify args but generic method parms, you then incur a Runtime check inside your advice every time it is executed.
From: aspectj-users-bounces@xxxxxxxxxxx on behalf of Kamil Dworakowski
Sent: Sun 9/3/2006 5:41 AM
To: wes@xxxxxxxxxxxxxx; aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] what for args pointcut designator?
When I read your response I have an impression that you have not read
the message. You respond to the question in the topic. Why would I write
the body if not for you to read it? The body clarifies the meaning of
the question in the topic.
In the message I asked for the most important reason for having args in
the language. I mentioned that I don't view the type bounding as an
important reason. I expect something more.
> this(), args(), and target() allow you to bind variables in a type-safe way and to do runtime tests.
> E.g., for
> 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.
>> 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
> aspectj-users mailing list
aspectj-users mailing list