You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mb...@apache.org on 2011/03/07 21:56:24 UTC

svn commit: r1078945 - in /commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub: AnnotationConfigurer.java AnnotationFactory.java

Author: mbenson
Date: Mon Mar  7 20:56:23 2011
New Revision: 1078945

URL: http://svn.apache.org/viewvc?rev=1078945&view=rev
Log:
adjust to Pair changes in latest lang3 snapshot

Modified:
    commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationConfigurer.java
    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/AnnotationConfigurer.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationConfigurer.java?rev=1078945&r1=1078944&r2=1078945&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationConfigurer.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/AnnotationConfigurer.java Mon Mar  7 20:56:23 2011
@@ -18,6 +18,7 @@ package org.apache.commons.proxy2.stub;
 
 import java.lang.annotation.Annotation;
 
+import org.apache.commons.lang3.ImmutablePair;
 import org.apache.commons.lang3.Pair;
 
 /**
@@ -53,7 +54,7 @@ public abstract class AnnotationConfigur
         if (configurer == this) {
             throw new IllegalArgumentException("An AnnotationConfigurer cannot configure its own child annotation");
         }
-        Pair<AnnotationFactory, ClassLoader> context = requireContext();
+        ImmutablePair<AnnotationFactory, ClassLoader> context = requireContext();
         return context.left.create(context.right, configurer);
     }
 
@@ -65,7 +66,7 @@ public abstract class AnnotationConfigur
      * @throws IllegalStateException if called other than when an {@link AnnotationFactory} is executing {@link #configure(Object)}
      */
     protected final <T extends Annotation> T child(Class<T> annotationType) {
-        Pair<AnnotationFactory, ClassLoader> context = requireContext();
+        ImmutablePair<AnnotationFactory, ClassLoader> context = requireContext();
         return context.left.create(context.right, annotationType);
     }
 
@@ -74,8 +75,8 @@ public abstract class AnnotationConfigur
      * @return a {@link Pair}
      * @throws IllegalStateException if no ongoing annotation stubbing could be detected
      */
-    synchronized Pair<AnnotationFactory, ClassLoader> requireContext() throws IllegalStateException {
-        Pair<AnnotationFactory, ClassLoader> result = AnnotationFactory.CONTEXT.get();
+    synchronized ImmutablePair<AnnotationFactory, ClassLoader> requireContext() throws IllegalStateException {
+        ImmutablePair<AnnotationFactory, ClassLoader> result = AnnotationFactory.CONTEXT.get();
         if (result == null) {
             throw new IllegalStateException("Could not detect ongoing annotation stubbing");
         }

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=1078945&r1=1078944&r2=1078945&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 Mon Mar  7 20:56:23 2011
@@ -26,7 +26,7 @@ import java.lang.reflect.Proxy;
 import java.util.Map;
 
 import org.apache.commons.lang3.AnnotationUtils;
-import org.apache.commons.lang3.Pair;
+import org.apache.commons.lang3.ImmutablePair;
 import org.apache.commons.proxy2.Interceptor;
 import org.apache.commons.proxy2.Invocation;
 import org.apache.commons.proxy2.Invoker;
@@ -52,8 +52,8 @@ public class AnnotationFactory {
     /**
      * Record the context of a call for possible use by nested annotation creations.
      */
-    static final ThreadLocal<Pair<AnnotationFactory, ClassLoader>> CONTEXT =
-        new ThreadLocal<Pair<AnnotationFactory, ClassLoader>>();
+    static final ThreadLocal<ImmutablePair<AnnotationFactory, ClassLoader>> CONTEXT =
+        new ThreadLocal<ImmutablePair<AnnotationFactory, ClassLoader>>();
 
     private static final ProxyFactory PROXY_FACTORY;
 
@@ -328,7 +328,7 @@ public class AnnotationFactory {
         try {
             CONFIGURER.set(configurer);
             if (outerContext) {
-                CONTEXT.set(Pair.of(this, classLoader));
+                CONTEXT.set(ImmutablePair.of(this, classLoader));
             }
             @SuppressWarnings("unchecked")
             final A result = (A) proxyFactory.createInvokerProxy(classLoader, ANNOTATION_INVOKER, getStubType());