@Test public void IfMethodExistsInCustomAnnotationRedirectsToIt_Test() { CustomAnnotation customAnnotation = UsingCustomAnnotation.class.getAnnotation(CustomAnnotation.class); ReferenceAnnotation annotationProxy = AnnotationProxyFactory.getAnnotationProxy(customAnnotation, ReferenceAnnotation.class); assertEquals(true,annotationProxy.deprecated()); }
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); }
AnnotationProxyFactory { 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); } }
AnnotationProxyFactory { 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); } private  AnnotationProxyFactory(); }
AnnotationProxyFactory { 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); } private  AnnotationProxyFactory(); static T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation); }
AnnotationProxyFactory { 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); } private  AnnotationProxyFactory(); static T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation);  }