I have the following class:
package x.y.z;
public class MyClass{
public void someMethod(SomeObject object){
//do somethinng
}
public void {
//do somethinng
}
}
Now I would like to set @PointCut
only on method someMethod(SomeObject object, int param1)
How can I do it?
Update I'm trying
@Pointcut("execution(x.y.z.MyClass.someMethod(x.y.z.SomeObject))") but I'm getting not well formed pointcut exception.
Point cut should be:
target(x.y.z.MyClass) && execution(<RETURN TYPE> someMethod(x.y.z.SomeObject))
Attach AspectJ to your classpath and use maven AOP plugin to compile this Aspect to bytecode, look at this example:
@Aspect
public class IOControlAspect {
@Around("execution(com...SomeClass.someMethod(*))")
public Object ioControlWrapper(ProceedingJoinPoint thisJoinPoint) throws Throwable {
{your code here}
return thisJoinPoint.proceed();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With