@@ -0,0 +1,2334 @@
+package com.github.davidmoten.rx;%0A%0Aimport static java.lang.annotation.ElementType.METHOD;%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport java.lang.annotation.Retention;%0Aimport java.lang.annotation.RetentionPolicy;%0Aimport java.lang.annotation.Target;%0Aimport java.lang.reflect.Method;%0A%0Aimport org.junit.Test;%0A%0Apublic class DynamicProxyTest %7B%0A%0A    @Target(%7B METHOD %7D)%0A    @Retention(RetentionPolicy.RUNTIME)%0A    public static @interface Column %7B%0A        String value();%0A    %7D%0A%0A    @Target(%7B METHOD %7D)%0A    @Retention(RetentionPolicy.RUNTIME)%0A    public static @interface Index %7B%0A        /**%0A         * 1 based index corresponding the index in a%0A         * %3Ccode%3EResultSet.getObject(index)%3C/code%3E call.%0A         * %0A         * @return the 1 based index that the annotated method corresponds to in%0A         *         the ResultSet%0A         */%0A        int value();%0A    %7D%0A%0A    public static interface Thing %7B%0A        @Column(%22table_id%22)%0A        int id();%0A%0A        @Index(2)%0A        String name();%0A%0A        @Column(%22desc%22)%0A        String description();%0A    %7D%0A%0A    @Test%0A    public void testDynamicProxy() %7B%0A        Thing t = ProxyService.newInstance(Thing.class);%0A        assertEquals(123, t.id());%0A        assertEquals(%22fred name%22, t.name());%0A        assertEquals(%22he's the business! desc%22, t.description());%0A    %7D%0A%0A    public static class ProxyService implements java.lang.reflect.InvocationHandler %7B%0A%0A        @SuppressWarnings(%22unchecked%22)%0A        public static %3CT%3E T newInstance(Class%3CT%3E cls) %7B%0A            return (T) java.lang.reflect.Proxy.newProxyInstance(cls.getClassLoader(),%0A                    new Class%5B%5D %7B cls %7D, new ProxyService());%0A        %7D%0A%0A        public Object invoke(Object proxy, Method m, Object%5B%5D args) throws Throwable %7B%0A            Column a = m.getAnnotation(Column.class);%0A            final String column;%0A            if (a == null)%0A                column = null;%0A            else%0A                column = a.value();%0A            String name = m.getName();%0A            if (name.equals(%22id%22)) %7B%0A                return 123;%0A            %7D else if (name.equals(%22name%22)) %7B%0A                return %22fred %22 + column;%0A            %7D else if (name.equals(%22description%22)) %7B%0A                return %22he's the business! %22 + column;%0A            %7D else%0A                throw new RuntimeException(%22unexpected%22);%0A        %7D%0A    %7D%0A%0A%7D%0A

add dynamic proxy test