From 8f8ea5ef2406e595a0716dc9c3dae1674d360c77 Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 14 Mar 2008 18:54:40 +0000 Subject: [PATCH] 205907 - world remembers registered handlers --- weaver5/java5-testsrc/CounterAspect.java | 52 ++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 weaver5/java5-testsrc/CounterAspect.java diff --git a/weaver5/java5-testsrc/CounterAspect.java b/weaver5/java5-testsrc/CounterAspect.java new file mode 100644 index 000000000..1ca126d02 --- /dev/null +++ b/weaver5/java5-testsrc/CounterAspect.java @@ -0,0 +1,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 v1.0 + * which accompanies this distribution and is available at + * http://eclipse.org/legal/epl-v10.html + * + * 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++; + } +} \ No newline at end of file -- 2.39.5