Class AnnotationMatchingPointcut

java.lang.Object
org.springframework.aop.support.annotation.AnnotationMatchingPointcut
All Implemented Interfaces:
Pointcut

public class AnnotationMatchingPointcut extends Object implements Pointcut
Simple Pointcut that looks for a specific Java 5 annotation being present on a class or method.
Since:
2.0
Author:
Juergen Hoeller, Sam Brannen
See Also:
  • Constructor Details

    • AnnotationMatchingPointcut

      public AnnotationMatchingPointcut(Class<? extends Annotation> classAnnotationType)
      Create a new AnnotationMatchingPointcut for the given annotation type.
      Parameters:
      classAnnotationType - the annotation type to look for at the class level
    • AnnotationMatchingPointcut

      public AnnotationMatchingPointcut(Class<? extends Annotation> classAnnotationType, boolean checkInherited)
      Create a new AnnotationMatchingPointcut for the given annotation type.
      Parameters:
      classAnnotationType - the annotation type to look for at the class level
      checkInherited - whether to also check the superclasses and interfaces as well as meta-annotations for the annotation type
      See Also:
    • AnnotationMatchingPointcut

      public AnnotationMatchingPointcut(@Nullable Class<? extends Annotation> classAnnotationType, @Nullable Class<? extends Annotation> methodAnnotationType)
      Create a new AnnotationMatchingPointcut for the given annotation types.
      Parameters:
      classAnnotationType - the annotation type to look for at the class level (can be null)
      methodAnnotationType - the annotation type to look for at the method level (can be null)
    • AnnotationMatchingPointcut

      public AnnotationMatchingPointcut(@Nullable Class<? extends Annotation> classAnnotationType, @Nullable Class<? extends Annotation> methodAnnotationType, boolean checkInherited)
      Create a new AnnotationMatchingPointcut for the given annotation types.
      Parameters:
      classAnnotationType - the annotation type to look for at the class level (can be null)
      methodAnnotationType - the annotation type to look for at the method level (can be null)
      checkInherited - whether to also check the superclasses and interfaces as well as meta-annotations for the annotation type
      Since:
      5.0
      See Also:
  • Method Details

    • getClassFilter

      public ClassFilter getClassFilter()
      Description copied from interface: Pointcut
      Return the ClassFilter for this pointcut.
      Specified by:
      getClassFilter in interface Pointcut
      Returns:
      the ClassFilter (never null)
    • getMethodMatcher

      public MethodMatcher getMethodMatcher()
      Description copied from interface: Pointcut
      Return the MethodMatcher for this pointcut.
      Specified by:
      getMethodMatcher in interface Pointcut
      Returns:
      the MethodMatcher (never null)
    • equals

      public boolean equals(@Nullable Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • forClassAnnotation

      public static AnnotationMatchingPointcut forClassAnnotation(Class<? extends Annotation> annotationType)
      Factory method for an AnnotationMatchingPointcut that matches for the specified annotation at the class level.
      Parameters:
      annotationType - the annotation type to look for at the class level
      Returns:
      the corresponding AnnotationMatchingPointcut
    • forMethodAnnotation

      public static AnnotationMatchingPointcut forMethodAnnotation(Class<? extends Annotation> annotationType)
      Factory method for an AnnotationMatchingPointcut that matches for the specified annotation at the method level.
      Parameters:
      annotationType - the annotation type to look for at the method level
      Returns:
      the corresponding AnnotationMatchingPointcut