@Test public void canCreateInvocationHandler() { final DatabaseIdentityStoreDefinition annotation = Color.class.getAnnotation(DatabaseIdentityStoreDefinition.class); final ELProcessor elProcessor = new ELProcessor(); elProcessor.getELManager().addELResolver(bm().getELResolver()); final InvocationHandler handler = new TomEEELInvocationHandler(annotation, elProcessor); final DatabaseIdentityStoreDefinition proxiedAnnotation = TomEEELInvocationHandler.of(DatabaseIdentityStoreDefinition.class, annotation, bm()); Assert.assertEquals("select password from caller where name = ?", proxiedAnnotation.callerQuery()); Assert.assertEquals(90, proxiedAnnotation.priority()); Assert.assertEquals("90", proxiedAnnotation.priorityExpression()); }
public static <T extends Annotation> T of(final Class<T> annotationClass, final T annotation, final BeanManager beanManager) { final ELProcessor elProcessor = new ELProcessor(); elProcessor.getELManager().addELResolver(beanManager.getELResolver()); return (T) Proxy.newProxyInstance(annotation.getClass().getClassLoader(), new Class[]{annotationClass}, new TomEEELInvocationHandler(annotation, elProcessor)); }
TomEEELInvocationHandler implements InvocationHandler { public static <T extends Annotation> T of(final Class<T> annotationClass, final T annotation, final BeanManager beanManager) { final ELProcessor elProcessor = new ELProcessor(); elProcessor.getELManager().addELResolver(beanManager.getELResolver()); return (T) Proxy.newProxyInstance(annotation.getClass().getClassLoader(), new Class[]{annotationClass}, new TomEEELInvocationHandler(annotation, elProcessor)); } }
TomEEELInvocationHandler implements InvocationHandler { public static <T extends Annotation> T of(final Class<T> annotationClass, final T annotation, final BeanManager beanManager) { final ELProcessor elProcessor = new ELProcessor(); elProcessor.getELManager().addELResolver(beanManager.getELResolver()); return (T) Proxy.newProxyInstance(annotation.getClass().getClassLoader(), new Class[]{annotationClass}, new TomEEELInvocationHandler(annotation, elProcessor)); } TomEEELInvocationHandler(final Annotation annotation, final ELProcessor processor); }
TomEEELInvocationHandler implements InvocationHandler { public static <T extends Annotation> T of(final Class<T> annotationClass, final T annotation, final BeanManager beanManager) { final ELProcessor elProcessor = new ELProcessor(); elProcessor.getELManager().addELResolver(beanManager.getELResolver()); return (T) Proxy.newProxyInstance(annotation.getClass().getClassLoader(), new Class[]{annotationClass}, new TomEEELInvocationHandler(annotation, elProcessor)); } TomEEELInvocationHandler(final Annotation annotation, final ELProcessor processor); @Override Object invoke(final Object proxy, final Method method, final Object[] args); static T of(final Class<T> annotationClass, final T annotation, final BeanManager beanManager); static T of(final Class<T> annotationClass, final T annotation, final ELProcessor elProcessor); }
TomEEELInvocationHandler implements InvocationHandler { public static <T extends Annotation> T of(final Class<T> annotationClass, final T annotation, final BeanManager beanManager) { final ELProcessor elProcessor = new ELProcessor(); elProcessor.getELManager().addELResolver(beanManager.getELResolver()); return (T) Proxy.newProxyInstance(annotation.getClass().getClassLoader(), new Class[]{annotationClass}, new TomEEELInvocationHandler(annotation, elProcessor)); } TomEEELInvocationHandler(final Annotation annotation, final ELProcessor processor); @Override Object invoke(final Object proxy, final Method method, final Object[] args); static T of(final Class<T> annotationClass, final T annotation, final BeanManager beanManager); static T of(final Class<T> annotationClass, final T annotation, final ELProcessor elProcessor);  }