Search in sources :

Example 1 with AuditParam

use of com.vip.saturn.job.console.aop.annotation.AuditParam in project Saturn by vipshop.

the class AuditLogAspect method addAuditParamsIfPossible.

private void addAuditParamsIfPossible(ProceedingJoinPoint joinPoint) {
    MethodSignature signature = (MethodSignature) joinPoint.getSignature();
    Annotation[][] annotations = signature.getMethod().getParameterAnnotations();
    int i = 0;
    for (Object arg : joinPoint.getArgs()) {
        for (Annotation annotation : annotations[i]) {
            if (annotation.annotationType() == AuditParam.class) {
                AuditParam auditParamAnno = (AuditParam) annotation;
                String value = auditParamAnno.value();
                if (value != null) {
                    AuditInfoContext.put(value, arg == null ? null : arg.toString());
                }
            }
        }
        i++;
    }
}
Also used : MethodSignature(org.aspectj.lang.reflect.MethodSignature) AuditParam(com.vip.saturn.job.console.aop.annotation.AuditParam) ProceedingJoinPoint(org.aspectj.lang.ProceedingJoinPoint) Annotation(java.lang.annotation.Annotation)

Aggregations

AuditParam (com.vip.saturn.job.console.aop.annotation.AuditParam)1 Annotation (java.lang.annotation.Annotation)1 ProceedingJoinPoint (org.aspectj.lang.ProceedingJoinPoint)1 MethodSignature (org.aspectj.lang.reflect.MethodSignature)1