001/*
002 * Copyright 2002-2018 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.core.Ordered;
020
021/**
022 * Interface to be implemented by types that can supply the information
023 * needed to sort advice/advisors by AspectJ's precedence rules.
024 *
025 * @author Adrian Colyer
026 * @since 2.0
027 * @see org.springframework.aop.aspectj.autoproxy.AspectJPrecedenceComparator
028 */
029public interface AspectJPrecedenceInformation extends Ordered {
030
031        // Implementation note:
032        // We need the level of indirection this interface provides as otherwise the
033        // AspectJPrecedenceComparator must ask an Advisor for its Advice in all cases
034        // in order to sort advisors. This causes problems with the
035        // InstantiationModelAwarePointcutAdvisor which needs to delay creating
036        // its advice for aspects with non-singleton instantiation models.
037
038        /**
039         * Return the name of the aspect (bean) in which the advice was declared.
040         */
041        String getAspectName();
042
043        /**
044         * Return the declaration order of the advice member within the aspect.
045         */
046        int getDeclarationOrder();
047
048        /**
049         * Return whether this is a before advice.
050         */
051        boolean isBeforeAdvice();
052
053        /**
054         * Return whether this is an after advice.
055         */
056        boolean isAfterAdvice();
057
058}