001/* 002 * Copyright 2002-2015 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.aop.aspectj; 018 019import java.io.Serializable; 020import java.lang.reflect.Method; 021 022import org.springframework.aop.MethodBeforeAdvice; 023 024/** 025 * Spring AOP advice that wraps an AspectJ before method. 026 * 027 * @author Rod Johnson 028 * @author Adrian Colyer 029 * @since 2.0 030 */ 031@SuppressWarnings("serial") 032public class AspectJMethodBeforeAdvice extends AbstractAspectJAdvice implements MethodBeforeAdvice, Serializable { 033 034 public AspectJMethodBeforeAdvice( 035 Method aspectJBeforeAdviceMethod, AspectJExpressionPointcut pointcut, AspectInstanceFactory aif) { 036 037 super(aspectJBeforeAdviceMethod, pointcut, aif); 038 } 039 040 041 @Override 042 public void before(Method method, Object[] args, Object target) throws Throwable { 043 invokeAdviceMethod(getJoinPointMatch(), null, null); 044 } 045 046 @Override 047 public boolean isBeforeAdvice() { 048 return true; 049 } 050 051 @Override 052 public boolean isAfterAdvice() { 053 return false; 054 } 055 056}