AnnotationMethodMatcher (Spring Framework 3.2.1.RELEASE API)
Date: 2013-01-24

org.springframework.aop.support.annotation

## Class AnnotationMethodMatcher

- java.lang.Object
- - org.springframework.aop.support.StaticMethodMatcher
  - - org.springframework.aop.support.annotation.AnnotationMethodMatcher

- All Implemented Interfaces:
    MethodMatcher

      public class AnnotationMethodMatcher
      extends StaticMethodMatcher

  Simple MethodMatcher that looks for a specific Java 5 annotation being present on a method (checking both the method on the invoked interface, if any, and the corresponding method on the target class).
  Since:
    2.0
  Author:
    Juergen Hoeller
  See Also:
    `AnnotationMatchingPointcut`

- - ### Field Summary

    - ### Fields inherited from interface org.springframework.aop.MethodMatcher

      `TRUE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AnnotationMethodMatcher(Class<? extends Annotation> annotationType)` Create a new AnnotationClassFilter for the given annotation type.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object other)`
    `int` | `hashCode()`
    `boolean` | `matches(Method method, Class targetClass)` Perform static checking whether the given method matches.

    - ### Methods inherited from class org.springframework.aop.support.StaticMethodMatcher

      `isRuntime, matches`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AnnotationMethodMatcher

          public AnnotationMethodMatcher(Class<? extends Annotation> annotationType)

      Create a new AnnotationClassFilter for the given annotation type.
      Parameters:
        `annotationType` - the annotation type to look for

  - ### Method Detail

    - #### matches

          public boolean matches(Method method,
                        Class targetClass)

      Description copied from interface: `MethodMatcher`
      Perform static checking whether the given method matches. If this returns `false` or if the `MethodMatcher.isRuntime()` method returns `false`, no runtime check (i.e. no. `MethodMatcher.matches(java.lang.reflect.Method, Class, Object[])` call) will be made.
      Parameters:
        `method` - the candidate method
        `targetClass` - the target class (may be `null`, in which case the candidate class must be taken to be the method's declaring class)
      Returns:
        whether or not this method matches statically

    - #### equals

          public boolean equals(Object other)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`