Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[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); 
        }
}




Back to the top