[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Help with defining a point cut
|
On Apr 26, 2009, at 6:55 PM, elad sofer wrote:
Hi all,
First i apologize if this kind of question have been asked in the
past, if
it was i could not find it.
I am a newbie to AspectJ and the problem we are trying to solve is
this:
There is a legacy code that we want to be able to connect to an
automatic
testing application (ROBOT).
This framework requires (recommended at least) that every swing
component
has the name attibute set.
I am looking for a way to do this with an aspect, that will "catch"
the
swing object at some phase and call the setName method.
Catching the object at some phase, I'd recommend the constructor. So
something like:
after (Component c) returning:
execution( javax.swing.Component.new(..)) && this(c) {
c.setName( <put your desired name here> );
}
Not sure if this() works with constructors, but something like that
should do the trick.
How to generate the name passed to setName() is up to you, since I
don't quite understand your requirements there.
Jochen