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


On Apr 27, 2009, at 7:08 AM, Elad Sofer wrote:

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'm still not sure what you mean when you say <Type>_<MemberName>. Is it something like this;

class A {

	private JLabel myPrivateLabel;

	A() {

		myPrivateLabel = new JLabel();
	}

	//methods

}

If it is, then I assume you want to set the name in the JLabel to "A_myPrivateLabel"? If that's the case you can change the "execution" join-point to "call", that at least gives you access to the current instance of "A". Catching the member name requires an additional bit of advice at every field assignment where you can check the type and remember the name if necessary.

If all this is not what you meant, I think you should give a code example.

Jochen



Back to the top