commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1000297 - /commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationFactory.java
Date Thu, 23 Sep 2010 03:16:49 GMT
Author: mbenson
Date: Thu Sep 23 03:16:46 2010
New Revision: 1000297

URL: http://svn.apache.org/viewvc?rev=1000297&view=rev
Log:
make sure static ProxyFactory exists before instantiating static AnnotationFactory with it

Modified:
    commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationFactory.java

Modified: commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationFactory.java?rev=1000297&r1=1000296&r2=1000297&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationFactory.java
(original)
+++ commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationFactory.java
Thu Sep 23 03:16:46 2010
@@ -45,9 +45,34 @@ import org.apache.commons.proxy2.impl.Ab
  */
 public class AnnotationFactory {
     /** Statically available instance */
-    public static final AnnotationFactory INSTANCE = new AnnotationFactory();
+    public static final AnnotationFactory INSTANCE;
 
-    //underlying proxyfactory implementation based on org.apache.commons.proxy2.jdk.JdkProxyFactory
+    private static final ProxyFactory PROXY_FACTORY;
+
+    static {
+
+        //underlying proxyfactory implementation based on org.apache.commons.proxy2.jdk.JdkProxyFactory
+        PROXY_FACTORY = new AbstractProxyFactory() {
+
+            public <T> T createInvokerProxy(ClassLoader classLoader, final Invoker
invoker, Class<?>... proxyClasses) {
+                throw new UnsupportedOperationException();
+            }
+
+            @SuppressWarnings("unchecked")
+            public <T> T createInterceptorProxy(ClassLoader classLoader, Object target,
Interceptor interceptor,
+                Class<?>... proxyClasses) {
+                return (T) Proxy.newProxyInstance(classLoader, proxyClasses, new InterceptorInvocationHandler(target,
+                    interceptor));
+            }
+
+            public <T> T createDelegatorProxy(ClassLoader classLoader, ObjectProvider<?>
delegateProvider,
+                Class<?>... proxyClasses) {
+                throw new UnsupportedOperationException();
+            }
+        };
+
+        INSTANCE = new AnnotationFactory();
+    }
 
     private static class InterceptorInvocationHandler implements InvocationHandler, Serializable
{
         /** Serialization version */
@@ -116,25 +141,6 @@ public class AnnotationFactory {
         }
     }
 
-    private static final ProxyFactory PROXY_FACTORY = new AbstractProxyFactory() {
-
-        public <T> T createInvokerProxy(ClassLoader classLoader, final Invoker invoker,
Class<?>... proxyClasses) {
-            throw new UnsupportedOperationException();
-        }
-
-        @SuppressWarnings("unchecked")
-        public <T> T createInterceptorProxy(ClassLoader classLoader, Object target,
Interceptor interceptor,
-            Class<?>... proxyClasses) {
-            return (T) Proxy.newProxyInstance(classLoader, proxyClasses, new InterceptorInvocationHandler(target,
-                interceptor));
-        }
-
-        public <T> T createDelegatorProxy(ClassLoader classLoader, ObjectProvider<?>
delegateProvider,
-            Class<?>... proxyClasses) {
-            throw new UnsupportedOperationException();
-        }
-    };
-
     private static final Invoker ANNOTATION_INVOKER = new Invoker() {
 
         /** Serialization version */



Mime
View raw message