Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Help with defining a point cut

Thanks for the reply,

The thing is that a join point after the Ctor is not suffiecient since i need to have the following name pattern <Type>_<MemberName>, this means that if i have a JLabel within class A and it is initialized in the declerative part i do not have access to the instance of A that holds the JLabel, and this is needed to be able to match the member name using reflection (or is it not ?).

I have tried catching the setVisible but apperantly it is not always called.

Any more advice will be great.

Elad.

On Sun, Apr 26, 2009 at 8:48 PM, Jochen Wuttke <jochen.wuttke@xxxxxx> wrote:

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



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top