find Annotation
Returns the AnnotationInfo for annotation T present on the intercepted function, or null if no such annotation is present.
Example
@Before(target = [RateLimit::class])
fun doBefore(jp: JoinPoint) {
val rateLimit = jp.findAnnotation<RateLimit>() ?: return
val limit = rateLimit.getArg<Int>("maxCalls")
}Content copied to clipboard
Returns the AnnotationInfo for annotation T present on this method signature, or null if no such annotation is present.
Example
@Before(target = [Secured::class])
fun doBefore(jp: JoinPoint) {
val secured = jp.signature.findAnnotation<Secured>() ?: return
val role = secured.getArg<String>("role")
}Content copied to clipboard