I have two annotation @LookAtThisMethod
and @LookAtThisParameter
, if I have a pointcut around the methods with @LookAtThisMethod
how could I extract the parameters of said method which are annotated with @LookAtThisParameter
?
For example:
@Aspect
public class LookAdvisor {
@Pointcut("@annotation(lookAtThisMethod)")
public void lookAtThisMethodPointcut(LookAtThisMethod lookAtThisMethod){}
@Around("lookAtThisMethodPointcut(lookAtThisMethod)")
public void lookAtThisMethod(ProceedingJoinPoint joinPoint, LookAtThisMethod lookAtThisMethod) throws Throwable {
for(Object argument : joinPoint.getArgs()) {
//I can get the parameter values here
}
//I can get the method signature with:
joinPoint.getSignature.toString();
//How do I get which parameters are annotated with @LookAtThisParameter?
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…