| Total Complexity | 3 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | 1 | package io.mcarle.sciurus.lock; |
|
| 9 | @Aspect |
||
| 10 | 1 | public class LockAspect { |
|
| 11 | |||
| 12 | /** |
||
| 13 | * Matches any execution of any method |
||
| 14 | */ |
||
| 15 | @Pointcut("execution(* *(..))") |
||
| 16 | void anyMethod() { |
||
| 17 | } |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Matches any method, which is annotated with {@link Lock} |
||
| 21 | */ |
||
| 22 | @Pointcut("@annotation(lock)") |
||
| 23 | void lockAnnotated(Lock lock) { |
||
| 24 | } |
||
| 25 | |||
| 26 | @Around(value = "anyMethod() && lockAnnotated(lock)", argNames = "joinPoint,lock") |
||
| 27 | public Object executionOfAnyMethodAnnotatedWithLock( |
||
| 28 | ProceedingJoinPoint joinPoint, |
||
| 29 | Lock lock |
||
| 30 | ) throws Throwable { |
||
| 31 | 1 | return LockAspectHandler.checkLockAndExecute(joinPoint, lock); |
|
| 32 | } |
||
| 34 |