aboutsummaryrefslogtreecommitdiffstats
path: root/weaver/src/test/java/CounterAspect.java
blob: 7faa4963d15081787887ddab2cc616002f24ea33 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* *******************************************************************
 * Copyright (c) 2008 Contributors.
 * All rights reserved.
 * This program and the accompanying materials are made available
 * under the terms of the Eclipse Public License v 2.0
 * which accompanies this distribution and is available at
 * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
 *
 * Contributors:
 *   Andy Clement         initial implementation
 * ******************************************************************/
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;

/**
 * Created to enable PointcutDesignatorHandlerTests.testParsingBeanInReferencePointcut01 and 02 to run
 *
 * @author Andy Clement
 */
@Aspect
public class CounterAspect {

    int count;

    @Before("execution(* set*(..)) && bean(testBean1)")
    public void increment1ForAnonymousPointcut() {
        count++;
    }

    @Pointcut("execution(* toString(..)) && bean(testBean1)")
    public void testBean1toString() {
    }

    @Pointcut("execution(* setAge(..)) && bean(testBean1)")
    public void testBean1SetAge() {
    }

    @Pointcut("execution(* setAge(..)) && bean(testBean2)")
    public void testBean2SetAge() {
    }

    @Before("testBean1SetAge()")
    public void increment1() {
        count++;
    }

    @Before("testBean2SetAge()")
    public void increment2() {
        count++;
    }
}