blob: d3f8e760306b7d9f1c43f44fd5a2c43444e1d213 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
package xxx.util;
import java.util.List;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
@Aspect
public class TaskHistoryAspect {
@Around("execution(@xxx.util.TaskModification * *.*(..))")
public Object aroundModification(ProceedingJoinPoint joinPoint) throws Throwable {
Task task = null;
List<Task> list = null;
for (Object arg : joinPoint.getArgs()) {
if (arg instanceof Task) {
task = (Task) arg;
} else if (arg instanceof List) {
list = (List) arg;
}
}
Object result = joinPoint.proceed(joinPoint.getArgs());
if (task != null) {
logModification(joinPoint, task);
} else {
logModification(joinPoint, list);
}
return result;
}
private void logModification(JoinPoint joinPoint, Task task) {
}
private void logModification(JoinPoint joinPoint, List<Task> tasks) {
}
}
|