Here you can find the source of getAnnotation(ProceedingJoinPoint pjp, Class
public static <T> T getAnnotation(ProceedingJoinPoint pjp, Class<T> annotationClass)
//package com.java2s; //License from project: Apache License import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.reflect.MethodSignature; import java.lang.annotation.Annotation; public class Main { public static <T> T getAnnotation(ProceedingJoinPoint pjp, Class<T> annotationClass) { final MethodSignature methodSignature = ((MethodSignature) pjp.getSignature()); final Annotation[] annotations = methodSignature.getMethod().getAnnotations(); T lookupAnnotation = null;//from w w w . ja v a 2 s. c o m for (Annotation annotation : annotations) { if (annotation.annotationType().equals(annotationClass)) { lookupAnnotation = (T) annotation; break; } } return lookupAnnotation; } }