Announcement Announcement Module
Collapse
No announcement yet.
Dump question (can AOP get return value from intercept method ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dump question (can AOP get return value from intercept method ?

    hi, i wondering that is AOP possible to do this ?

    say i got a method

    Code:
    public interface UserManagementService
    {
     public User getUser(long id);
    }

    Code:
    @Aspect
    public class UserManagementAspect
    {
    //or maybe a point cut that intercept return value ??
     @After("execution(* UserManagementService.getUser(..)&&arg(id)") 
     public void processUser(long id)
     {
           User user = ... //value return by getUser() 
     }
    
    }

    is that possible to do something like this ?

    kiwi
    ---
    happy hacking !

  • #2
    If you check the reference guide, or the AspectJ reference guide for that matter you notice a AfterReturning advice (instead of the After advice). That way you have access to the returned value.

    Comment


    • #3
      ok, thx thx !! problem solve !

      couldn't believe i miss that @afterReturning !

      thx a lot guy !

      kiwi
      ----
      happy hacking !

      Comment

      Working...
      X