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;
018
019import java.lang.reflect.Method;
020
021/**
022 * A specialized type of {@link MethodMatcher} that takes into account introductions
023 * when matching methods. If there are no introductions on the target class,
024 * a method matcher may be able to optimize matching more effectively for example.
025 *
026 * @author Adrian Colyer
027 * @since 2.0
028 */
029public interface IntroductionAwareMethodMatcher extends MethodMatcher {
030
031        /**
032         * Perform static checking whether the given method matches. This may be invoked
033         * instead of the 2-arg {@link #matches(java.lang.reflect.Method, Class)} method
034         * if the caller supports the extended IntroductionAwareMethodMatcher interface.
035         * @param method the candidate method
036         * @param targetClass the target class
037         * @param hasIntroductions {@code true} if the object on whose behalf we are
038         * asking is the subject on one or more introductions; {@code false} otherwise
039         * @return whether or not this method matches statically
040         */
041        boolean matches(Method method, Class<?> targetClass, boolean hasIntroductions);
042
043}