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; 023import org.springframework.lang.Nullable; 024 025/** 026 * Spring AOP advice that wraps an AspectJ before method. 027 * 028 * @author Rod Johnson 029 * @author Adrian Colyer 030 * @since 2.0 031 */ 032@SuppressWarnings("serial") 033public class AspectJMethodBeforeAdvice extends AbstractAspectJAdvice implements MethodBeforeAdvice, Serializable { 034 035 public AspectJMethodBeforeAdvice( 036 Method aspectJBeforeAdviceMethod, AspectJExpressionPointcut pointcut, AspectInstanceFactory aif) { 037 038 super(aspectJBeforeAdviceMethod, pointcut, aif); 039 } 040 041 042 @Override 043 public void before(Method method, Object[] args, @Nullable Object target) throws Throwable { 044 invokeAdviceMethod(getJoinPointMatch(), null, null); 045 } 046 047 @Override 048 public boolean isBeforeAdvice() { 049 return true; 050 } 051 052 @Override 053 public boolean isAfterAdvice() { 054 return false; 055 } 056 057}