001/*
002 * Copyright 2002-2012 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.annotation;
018
019import org.springframework.aop.framework.AopConfigException;
020
021/**
022 * Extension of AopConfigException thrown when trying to perform
023 * an advisor generation operation on a class that is not an
024 * AspectJ annotation-style aspect.
025 *
026 * @author Rod Johnson
027 * @since 2.0
028 */
029@SuppressWarnings("serial")
030public class NotAnAtAspectException extends AopConfigException {
031
032        private Class<?> nonAspectClass;
033
034
035        /**
036         * Create a new NotAnAtAspectException for the given class.
037         * @param nonAspectClass the offending class
038         */
039        public NotAnAtAspectException(Class<?> nonAspectClass) {
040                super(nonAspectClass.getName() + " is not an @AspectJ aspect");
041                this.nonAspectClass = nonAspectClass;
042        }
043
044        /**
045         * Returns the offending class.
046         */
047        public Class<?> getNonAspectClass() {
048                return this.nonAspectClass;
049        }
050
051}