Hi All, 

I had a aspect, and java file.


If input is null then i want to return from method.
currently i am just returning from the aspect.

so basically, i want that following line should not execute.
 System.out.println("Printing .... ");

It should be equivalent to following code.
    public void jsSet_print(String xyz) throws Exception, IOException {
        if(xyz!= null){
              System.out.println("Printing .... ");
        }
    }

If it is not possible using before, how can i do this?

Is this is possible by around ?

File attached.

Thanks a lot.
Rajat


      
import java.lang.reflect.Field;
import java.lang.reflect.Method;

import com.sun.org.apache.bcel.internal.generic.RETURN;

import pkg.*;


public aspect Internal {


        pointcut setterPointcut(Object input): within(pkg.*) && args(input) && 
execution(* jsSet_*(*) throws *);        

        before(Object input) : setterPointcut(input){
                if (input == null) {
                        System.out.println("null");
                        return ;
                }
        }
}
package pkg;
import java.io.IOException;

public class RunAspect {
        public int x;
        private String y;
        
        public static void main(String[] args) throws Exception{
                RunAspect runAspect = new RunAspect();
                runAspect.jsSet_print(null);
        }

        public void jsSet_print(String xyz) throws Exception, IOException {
                System.out.println("Printing .... ");
        }

}
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to