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 2013/09/03 23:53:08 UTC

svn commit: r1519864 - in /commons/proper/proxy/branches/version-2.0-work/stub/src: main/java/org/apache/commons/proxy2/stub/StubInterceptorBuilder.java test/java/org/apache/commons/proxy2/stub/StubInterceptorBuilderTest.java

Author: mbenson
Date: Tue Sep  3 21:53:08 2013
New Revision: 1519864

URL: http://svn.apache.org/r1519864
Log:
Trainer knows its type

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

Modified: commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/StubInterceptorBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/StubInterceptorBuilder.java?rev=1519864&r1=1519863&r2=1519864&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/StubInterceptorBuilder.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/StubInterceptorBuilder.java Tue Sep  3 21:53:08 2013
@@ -48,12 +48,12 @@ public class StubInterceptorBuilder
         return interceptor;
     }
 
-    public <T> StubInterceptorBuilder trainFor(Class<T> type, Trainer<T> trainer)
+    public <T> StubInterceptorBuilder train(Trainer<T> trainer)
     {
         try
         {
-            TrainingContext trainingContext = TrainingContext.set(proxyFactory);
-            T stub = trainingContext.push(type, interceptor);
+            final TrainingContext trainingContext = TrainingContext.set(proxyFactory);
+            final T stub = trainingContext.push(trainer.traineeType, interceptor);
             trainer.train(stub);
         }
         finally

Modified: commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubInterceptorBuilderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubInterceptorBuilderTest.java?rev=1519864&r1=1519863&r2=1519864&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubInterceptorBuilderTest.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubInterceptorBuilderTest.java Tue Sep  3 21:53:08 2013
@@ -50,7 +50,7 @@ public class StubInterceptorBuilderTest 
     @Override
     protected StubInterface createProxy(Trainer<StubInterface> trainer)
     {
-        Interceptor interceptor = builder.trainFor(StubInterface.class, trainer).build();
+        Interceptor interceptor = builder.train(trainer).build();
         return proxyFactory.createInterceptorProxy(
                 proxyFactory.createInvokerProxy(NullInvoker.INSTANCE, StubInterface.class),
                 interceptor,