001/* 002 * Copyright 2002-2016 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 org.springframework.aop.Pointcut; 020import org.springframework.aop.support.AbstractGenericPointcutAdvisor; 021import org.springframework.beans.factory.BeanFactory; 022import org.springframework.beans.factory.BeanFactoryAware; 023 024/** 025 * Spring AOP Advisor that can be used for any AspectJ pointcut expression. 026 * 027 * @author Rob Harrop 028 * @since 2.0 029 */ 030@SuppressWarnings("serial") 031public class AspectJExpressionPointcutAdvisor extends AbstractGenericPointcutAdvisor implements BeanFactoryAware { 032 033 private final AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut(); 034 035 036 public void setExpression(String expression) { 037 this.pointcut.setExpression(expression); 038 } 039 040 public String getExpression() { 041 return this.pointcut.getExpression(); 042 } 043 044 public void setLocation(String location) { 045 this.pointcut.setLocation(location); 046 } 047 048 public String getLocation() { 049 return this.pointcut.getLocation(); 050 } 051 052 public void setParameterNames(String... names) { 053 this.pointcut.setParameterNames(names); 054 } 055 056 public void setParameterTypes(Class<?>... types) { 057 this.pointcut.setParameterTypes(types); 058 } 059 060 @Override 061 public void setBeanFactory(BeanFactory beanFactory) { 062 this.pointcut.setBeanFactory(beanFactory); 063 } 064 065 @Override 066 public Pointcut getPointcut() { 067 return this.pointcut; 068 } 069 070}