-
Aug 16th, 2012, 05:17 AM
#1
Need to apply an advice to method of interface regardless implementing class
Hi Guys...
just want to put an advice to a method of an interface, not class. I mean, whenever the one method e.g. addName() of an interface "MyInterface" invoked through some implementing class object, an advice on that method will run.
If this is possible then we can minimize no. of proxy object on every implementing class.
--------------------------------------------------------------------------------
e.g:
interface myInterface{ public void addMyName(String name); }
class SomeMyClass implements myInterface {
public void addName(String name){
//.....
}
}
@Aspect
class myInterfaceProxy implements BeforeAdvice{
@Before("execute(* com.myInterface.addName(..))")
public void before(Method arg0, Object[] arg1, Object arg2){
//...
}
}
-----------------------------------------------------------------
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules