Results 1 to 3 of 3

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

  1. #1

    Default 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3

    Default

    ok, thx thx !! problem solve !

    couldn't believe i miss that @afterReturning !

    thx a lot guy !

    kiwi
    ----
    happy hacking !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •