Well if you can't hardcode the interface name then the you can intercept all
method executions and then the JoinPoint.StaticPart state to determine at
runtime if you are interested in it.
before(): execution(* *(..)) {
System.out.println(thisJoinPointStaticPart);
}
that may match a lot of places though. If you can exploit the existence of
annotations, that may help, something like this to indicate the declaring
type must have the @Remote annotation.
before(): execution(* (@Remote *).*(..)) {
System.out.println(thisJoinPointStaticPart);
}
Andy
2009/7/28 ppkluk <[email protected]>
>
> Hi all,
>
> i am new to aspectj and i am trying to write aspect to capture the method
> of all a session bean (EJB 3.0 syntax).
>
> the methods i want to captures are the 'business method' in the session
> bean.
> As EJB 3.0 session bean can be created in the following form:
>
> --------------------------------------------------------------
> //interface defining the session bean method
> public interface SessionBeanInterface {
> public void advicedMethod();
> }
> --------------------------------------------------------------
>
> @Stateless(name="MySessionBean")
> @Remote(SessionBeanInterface.class) //indicate SesionBeanInterface is the
> remote bussinesss interface
> public class SessionBean implements SessionBeanInterface {
>
> public void advicedMethod(){
> //this method to be captured by before execution(...) pointcut
>
> }
>
> public void nonAdvicedMethod() {
> //this method is NOT to be captured
> }
> }
> -------------------------------------------------------------------
>
> in this situation, is this possible to write pointcut to capture only the
> methods declared
> in the SessionBeanInterface interface??
>
> *** i CANNOT HARDCODE the interface type in the aspect as i am now writing
> a
> *** generic tool aims to capture all the method execution.
>
> thank you.
>
> ppkluk
> --
> View this message in context:
> http://www.nabble.com/how-to-capture-method-joinpoints-in-EJB3-session-bean-interface--tp24703854p24703854.html
> Sent from the AspectJ - users mailing list archive at Nabble.com.
>
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users