Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] toString Aspect aspect browser

Jon,

I got it to work with the following:

       public pointcut myClass(Object obj) : within(com.philips.sct..*)
		&& this(obj);

	public pointcut myToString(Object obj) : 
		myClass(obj)
		&& execution(public String toString());

	String around(Object obj) : myToString(obj) {
		return StringUtil.toString(obj); 
	}

Thanks,

Ron DiFrango


-----Original Message-----
From: jon.pallas@xxxxxxxxxxx [mailto:jon.pallas@xxxxxxxxxxx] 
Sent: Thursday, July 24, 2003 7:58 AM
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users] toString Aspect aspect browser


Hi All 


I am new to aspectj so I may be doing something simple wrong any help 
would be apperciated.

I have writen an Aspect that i want to intersept any call to toString(). 
The code is below
using the aspect browser in eclipse i can see that it only affects classes 
that are not in 
com.philips.sct? but his is what i want tbe be affected? 

Is it just the browser or is it my code?

Thanks
Jon




1)

package com.philips.sct.aspects;

import com.philips.common.util.StringUtil;

public aspect ToStringEnhancerAspect {
 
        public pointcut myClass(Object obj) : within(com.philips.sct..*) 
&& this(obj);

 
        public pointcut myAspects() : within(com.philips.sct.aspects.*);
 
 
        public pointcut myToString(Object obj) : !myAspects()
                        &&  myClass(obj)
                        &&  call(public String toString())
                        ;

        String around (Object obj): myToString(obj){
                return StringUtil.toString(obj); 
        }
}


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users
 
**************************************************************************
The information transmitted herewith is sensitive information intended only
for use by the individual or entity to which it is addressed. If the reader
of this message is not the intended recipient, you are hereby notified that
any review, retransmission, dissemination, distribution, copying or other
use of, or taking of any action in reliance upon this information is
strictly prohibited. If you have received this communication in error,
please contact the sender and delete the material from your computer.


Back to the top