Author: jcarman
Date: Thu Aug  1 20:19:56 2013
New Revision: 1509416

URL: http://svn.apache.org/r1509416
Log:
Simplifying the API a bit.

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

Modified: 
commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/Trainer.java
URL: 
http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/Trainer.java?rev=1509416&r1=1509415&r2=1509416&view=diff
==============================================================================
--- 
commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/Trainer.java
 (original)
+++ 
commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/Trainer.java
 Thu Aug  1 20:19:56 2013
@@ -134,7 +134,7 @@ public abstract class Trainer<T>
         {
             R trainee = trainingContext().push(type);
             trainer.train(trainee);
-            
trainingContext().then(InterceptorUtils.constant(trainingContext().popStub(type)));
+            
trainingContext().then(InterceptorUtils.constant(trainingContext().pop()));
             return Trainer.this;
         }
 

Modified: 
commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/TrainingContext.java
URL: 
http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/TrainingContext.java?rev=1509416&r1=1509415&r2=1509416&view=diff
==============================================================================
--- 
commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/TrainingContext.java
 (original)
+++ 
commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/TrainingContext.java
 Thu Aug  1 20:19:56 2013
@@ -62,12 +62,13 @@ public class TrainingContext
         return frameDeque.peek();
     }
 
-    <T> T popStub(Class<T> type)
+    <T> T pop()
     {
+        final TrainingContextFrame<?> frame = frameDeque.pop();
         return proxyFactory.createInterceptorProxy(
-                proxyFactory.createInvokerProxy(NullInvoker.INSTANCE, type),
-                frameDeque.pop().stubInterceptor,
-                type);
+                proxyFactory.createInvokerProxy(NullInvoker.INSTANCE, 
frame.type),
+                frame.stubInterceptor,
+                frame.type);
     }
 
     <T> T push(Class<T> type)
@@ -77,7 +78,7 @@ public class TrainingContext
 
     <T> T push(Class<T> type, SwitchInterceptor switchInterceptor)
     {
-        TrainingContextFrame<T> frame = new 
TrainingContextFrame<T>(switchInterceptor);
+        TrainingContextFrame<T> frame = new TrainingContextFrame<T>(type, 
switchInterceptor);
         Invoker invoker = new TrainingInvoker(frame);
         frameDeque.push(frame);
         return proxyFactory.createInvokerProxy(invoker, type);
@@ -156,8 +157,11 @@ public class TrainingContext
 
         private InvocationMatcher matcher = null;
 
-        private TrainingContextFrame(SwitchInterceptor stubInterceptor)
+        private final Class<T> type;
+
+        private TrainingContextFrame(Class<T> type, SwitchInterceptor 
stubInterceptor)
         {
+            this.type = type;
             this.stubInterceptor = stubInterceptor;
         }
 


Reply via email to