protected static <T extends Annotation> T getAnnotationFromContext(InvocationContext context, Class<T> clazz) {
        T result = context.getMethod().getAnnotation(clazz);
        return result != null ? result : context.getTarget().getClass().getAnnotation(clazz);
    }
protected static < T extends Annotation > T getAnnotationFromContext ( InvocationContext context , Class < T > clazz ) { T result = context . getMethod ( ) . getAnnotation ( clazz ) ; return result != null ? result : context . getTarget ( ) . getClass ( ) . getAnnotation ( clazz ) ; }
Finds given annotation from {@link InvocationContext} (actually from method or class).

@param context {@link InvocationContext}
@param clazz annotation class
@param <T> type of the annotation
@return annotation instance