GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

io.mcarle.sciurus.cache.CacheAspect   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 33
ccs 4
cts 4
cp 1
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A anyMethodWithMinimumOneNonSerializableParameter() 0 2 1
A anyMethodReturningSerializable() 0 2 1
A startedAndExecutionOfAnyMethodAnnotatedWithCache(ProceedingJoinPoint,Cache) 0 9 2
A cacheAnnotated(Cache) 0 2 1
1 1
package io.mcarle.sciurus.cache;
2
3
import io.mcarle.sciurus.Sciurus;
4
import io.mcarle.sciurus.annotation.Cache;
5
import org.aspectj.lang.ProceedingJoinPoint;
6
import org.aspectj.lang.annotation.Around;
7
import org.aspectj.lang.annotation.Aspect;
8
import org.aspectj.lang.annotation.Pointcut;
9
10
@Aspect
11 1
public class CacheAspect {
12
13
    /**
14
     * Matches any execution of any method returning a serializable result
15
     */
16
    @Pointcut("execution((java.io.Serializable+ || byte || short || int || long || float || double || char || boolean) *(..))")
17
    void anyMethodReturningSerializable() {
18
    }
19
20
    /**
21
     * Matches any execution of any method with at least one non serializable parameter
22
     */
23
    @Pointcut("execution(* *(.., !(java.io.Serializable+ || byte || short || int || long || float || double || char || boolean), ..))")
24
    void anyMethodWithMinimumOneNonSerializableParameter() {
25
    }
26
27
    /**
28
     * Matches any method, which is annotated with {@link Cache}
29
     */
30
    @Pointcut("@annotation(cache)")
31
    void cacheAnnotated(Cache cache) {
32
    }
33
34
    @Around(value = "anyMethodReturningSerializable() && !anyMethodWithMinimumOneNonSerializableParameter() && cacheAnnotated(cache)", argNames = "joinPoint,cache")
35
    public Object startedAndExecutionOfAnyMethodAnnotatedWithCache(
36
            ProceedingJoinPoint joinPoint,
37
            Cache cache
38
    ) throws Throwable {
39 1
        if (Sciurus.isCacheStarted()) {
40 1
            return CacheAspectHandler.executeAndCache(joinPoint, cache);
41
        } else {
42 1
            return joinPoint.proceed();
43
        }
44
    }
45
}
46