Doh! Of course! Did you get an error when you used "within"? It's supposed to just take a type expression.
dean

On Jan 24, 2008, at 12:36 PM, Parmar, Dipak (IS Consultant) wrote:

“withincode” make it work. Here is the working pointcut.

@Pointcut("call(* java.sql.Statement+.execute*(..)) && withincode(@com.xyz.Profiling * *(..)) ")

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] ] On Behalf Of Parmar, Dipak (IS Consultant)
Sent: Wednesday, January 23, 2008 4:44 PM
To: [email protected]
Subject: RE: [aspectj-users] How to write pointcut

Doesn’t work.

This will work if Profiling is a class level annotation. In my case, it’s a method level annotation.


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] ] On Behalf Of Dean Wampler
Sent: Wednesday, January 23, 2008 4:27 PM
To: [email protected]
Subject: Re: [aspectj-users] How to write pointcut

I can never remember the correct syntax, so I looked at one of my aspects that uses annotations ;)

I think you want to remove the '@' from the "within", i.e.,

@Pointcut("call(* java.sql.Statement+.execute*(..)) && within(@com.xyz.Profiling * *(..)) ")


Hope this helps!

dean

On Jan 23, 2008, at 3:11 PM, Parmar, Dipak (IS Consultant) wrote:

I’m writing an aspect to major a performance of a stored-procedure call. I would like my aspect to get called when the method has “Profiling” aspect. I tried various approach but it can’t seem to make it work.

Here is the snippet of code:

public class JDBCProfilingAspect {

            @Profiling
            public void makeProfileDataBaseCall() {

                        .............
CallableStatement statement = connection.prepareCall("{ call PACKAGE.PROCEDURE(?) }");
                statement.execute();
                        ........................
            }

            public void makeDataBaseCall() {

                        .............
CallableStatement statement = connection.prepareCall("{ call PACKAGE.PROCEDURE(?) }");
                statement.execute();
                        ........................
            }

}

// Doesn’t work
@Pointcut("call(* java.sql.Statement+.execute*(..)) && @within(@com.xyz.Profiling * *(..)) ")
public void profileJDBCExecute() {
}

// Doesn’t work
@Pointcut("call(* java.sql.Statement+.execute*(..)) && @annotation(com.xyz.Profiling * *(..)) ")
public void profileJDBCExecute() {
}


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

Dean Wampler, Ph.D.
dean at objectmentor.com
http://www.objectmentor.com
See also:
http://www.aspectprogramming.com  AOP advocacy site
http://aquarium.rubyforge.org     AOP for Ruby
http://www.contract4j.org         Design by Contract for Java5



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

Dean Wampler, Ph.D.
dean at objectmentor.com
http://www.objectmentor.com
See also:
http://www.aspectprogramming.com  AOP advocacy site
http://aquarium.rubyforge.org     AOP for Ruby
http://www.contract4j.org         Design by Contract for Java5



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

Reply via email to