1 /**************************************************************************************2 * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *3 * http://aspectwerkz.codehaus.org *4 * ---------------------------------------------------------------------------------- *5 * The software in this package is published under the terms of the LGPL license *6 * a copy of which has been included with this distribution in the license.txt file. *7 **************************************************************************************/8 package test.orthogonal;9 10 import test.Loggable;11 import org.codehaus.aspectwerkz.definition.Pointcut;12 import org.codehaus.aspectwerkz.joinpoint.JoinPoint;13 14 /**15 * @author <a HREF="mailto:jboner@codehaus.org">Jonas BonŽr </a>16 * @Aspect perJVM17 */18 public class OrthogonalTestAspect {19 // ============ Pointcuts ============20 21 /**22 * @Expression execution(* test.orthogonal.OrthogonalTest.method*(..))23 */24 Pointcut pcMethod;25 26 /**27 * @Expression get(* test.orthogonal.OrthogonalTest.m_getFieldAroundAdviced) && within(test.orthogonal.*)28 */29 Pointcut pcGet;30 31 /**32 * @Expression set(* test.orthogonal.OrthogonalTest.m_setFieldAroundAdviced) && within(test.orthogonal.*)33 */34 Pointcut pcSet;35 36 // ============ Advices ============37 38 /**39 * @Around pcMethod || pcGet || pcSet40 */41 public Object advice1(final JoinPoint joinPoint) throws Throwable {42 ((Loggable) joinPoint.getTarget()).log("before ");43 Object o = joinPoint.proceed();44 ((Loggable) joinPoint.getTarget()).log("after ");45 return o;46 }47 }