X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=test%2Fenterprise%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fsupport%2FThreadSpecificProxyFactory.java;h=b024e9785fa0c870d41fbf55be6fc77b4dc7dd9b;hb=fa55b36236c7f7cfb23dc88ff4b4556d159dff23;hp=e47c037ac8f23e56086235c4758c8df7a759c2ad;hpb=892308472780286f05a3f373cbc11f6f2a32a811;p=utils diff --git a/test/enterprise/src/main/java/org/wamblee/support/ThreadSpecificProxyFactory.java b/test/enterprise/src/main/java/org/wamblee/support/ThreadSpecificProxyFactory.java index e47c037a..b024e978 100644 --- a/test/enterprise/src/main/java/org/wamblee/support/ThreadSpecificProxyFactory.java +++ b/test/enterprise/src/main/java/org/wamblee/support/ThreadSpecificProxyFactory.java @@ -26,6 +26,14 @@ import java.lang.reflect.Proxy; * * It is used for instance to pass a transaction scoped entity manager around. * + * The {@link #set(Object)} method sets the current service instance for the current thread. + * The {@link #get()} method gets the current service instance for the current thread. + * The {@link #getProxy()} method gets a proxy that will delegate at runtime to the thread-specific + * instance. The result from this method can be passed at construction of an object that will be used + * by multiple threads. + * + * This class is mostly used by other test tools. + * * @param T * Interface to proxy. * @author Erik Brakkee @@ -71,6 +79,14 @@ public class ThreadSpecificProxyFactory { public void set(T aService) { svc.set(aService); } + + /** + * Gets the current thread-specific service. + * @return Service. + */ + public T get() { + return svc.get(); + } /** * Gets the proxy that delegates to the thread-specific instance set by