Thanks, I will try this one, it sounds good. :) Will let you know if it worked.
Elad. On Mon, Apr 27, 2009 at 10:54 AM, Jochen Wuttke <[email protected]>wrote: > > On Apr 27, 2009, at 9:19 AM, Elad Sofer wrote: > > Thanks again, >> >> What i mean by my pattern (refering to your code example), is that i need >> to set the name of myPrivateLabel to "JLabel_myPrivateLabel". I was not able >> to do that since our code sometimes looks like this: >> >> class A { >> >> private JLabel myPrivateLabel = new JLabel(); >> private JLabel anotherPrivateLabel; >> >> A() { >> anotherPrivateLabel = new JLabel(); >> } >> //methods >> } >> >> I need to be able to handle both cases and dont really understand how. >> > > OK, I think I see the problem now. Try what I suggested before: > > - use the set() join-point to capture all assignments to type > javax.swing.Component (or whatever it is you are interested in) > - grab the name of the assigned field from the locally available info > (dunno how, but should be straightforward with something like target() or > thisJoinPoint()) > - use reflection to read out the rest of the info you need to build the > name > - call setName() (by reflection) > > > Jochen > > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users >
_______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
