org.wamblee.support
Class ThreadSpecificProxyFactory<T>

java.lang.Object
  extended by org.wamblee.support.ThreadSpecificProxyFactory<T>

public class ThreadSpecificProxyFactory<T>
extends java.lang.Object

Thread-specific proxy is used to create implementations of interfaces that delegate to a thread-specific implementation of the service. It is used for instance to pass a transaction scoped entity manager around.

Author:
Erik Brakkee

Constructor Summary
ThreadSpecificProxyFactory(java.lang.Class<T> aClass)
          Constructs the factory.
 
Method Summary
 T getProxy()
          Gets the proxy that delegates to the thread-specific instance set by set(Object)
 void set(T aService)
          Sets the thread-specific service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadSpecificProxyFactory

public ThreadSpecificProxyFactory(java.lang.Class<T> aClass)
Constructs the factory.

Parameters:
aClass - Interface class of the service to proxy.
Method Detail

set

public void set(T aService)
Sets the thread-specific service.

Parameters:
aService - Service, use null value to reset.

getProxy

public T getProxy()
Gets the proxy that delegates to the thread-specific instance set by set(Object)

Returns:
Proxy.


Copyright © 2010. All Rights Reserved.