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