Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] around advice and return type mismatch ?

I got a solution.
Is this a correct way or there is a better way for solving this issue, please tell.

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


    void around(Object input) : setterPointcut(input){
        if (input != null) {
            System.out.println(input);
            proceed(input);
           
        }
    }

    Object around(Object input) : setterPointcut1(input){
        if (input != null) {
            System.out.println(input + " 2 ");
            proceed(input);
        }
        return null;
    }


Thanks
Rajat


From: Rajat Gupta <innocent_person1@xxxxxxxxx>
To: aspect-J <aspectj-users@xxxxxxxxxxx>
Sent: Fri, April 16, 2010 3:56:14 PM
Subject: [aspectj-users] around advice and return type mismatch ?

Hi All,

File for this example are attached.
The main problem is the around advice, how should i call that around advice?

I want to insert put around advice on these both following methods,

     public void jsSet_print(String xyz) throws Exception, IOException

    public Object jsSet_print3(String xyz) throws Exception, IOException

so i created a pointcut,  i think should be
    pointcut setterPointcut(Object input): within(pkg.*) && args(input) && execution(* jsSet_*(*));   
to match with both.

now by doing this advice
    void around(Object input) : setterPointcut(input){

it gave the error (runs fine though).

I had also tried with,
    Object around(Object input) : setterPointcut(input){

please suggest how should i do it so that both the methods has the aspect inserted.


Thanks
Rajat



Back to the top