001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.shiro.aop;
020
021import java.lang.annotation.Annotation;
022
023/**
024 * Defines an AOP-framework-independent way of determining if an Annotation exists on a Method.
025 *
026 * @since 1.1
027 */
028public interface AnnotationResolver {
029
030    /**
031     * Returns an {@link Annotation} instance of the specified type based on the given
032     * {@link MethodInvocation MethodInvocation} argument, or {@code null} if no annotation
033     * of that type could be found. First checks the invoked method itself and if not found, 
034     * then the class for the existence of the same annotation. 
035     *
036     * @param mi the intercepted method to be invoked.
037     * @param clazz the annotation class of the annotation to find.
038     * @return the method's annotation of the specified type or {@code null} if no annotation of
039     *         that type could be found.
040     */
041    Annotation getAnnotation(MethodInvocation mi, Class<? extends Annotation> clazz);
042}