Placing advice on any parameter of a given type in AspectJ

Posted by user12558 on Programmers See other posts from Programmers or by user12558
Published on 2011-01-06T16:54:17Z Indexed on 2011/01/06 16:59 UTC
Read the original article Hit count: 170

Filed under:

Hi, Im doing a POC using Aspectj.

class BaseInfo{..}

class UserInfo extends BaseInfo{..}

class UserService {

public void getUser(UserInfo userInfo){..}

public void deleteUser(String userId){..}

}

I've defined an advice, that gets invoked when I pass an UserInfo instance.But when i try to pass the BaseInfo, the advice is not getting invoked.

Below block executes the afterMethod as expected for getUser.

&ltaop:pointcut id="aopafterMethod" expression="execution(* UserService.*(..,UserInfo,..))" />

&gtaop:after pointcut-ref="aopafterMethod" method="afterMethod" />

But when i try to give BaseInfo instead of UserInfo, the aspect is not getting triggered.

Am i missing something? Kindly help me on this issue.

© Programmers or respective owner

Related posts about aspect-oriented