@ SuppressWarnings ( "unchecked" ) public static < T extends Annotation > T getAnnotationProxy ( Annotation customAnnotation , Class < T > referenceAnnotation ) { InvocationHandler handler = new AnnotationInvocationHandler ( customAnnotation ) ; return ( T ) Proxy . newProxyInstance ( referenceAnnotation . getClassLoader ( ) , new Class [ ] { referenceAnnotation } , handler ) ; }
Returns a proxy on the customAnnotation having the same type than the referenceAnnotation