org.wamblee.general
Class SerializableProxyFactory<T>

java.lang.Object
  extended by org.wamblee.general.SerializableProxyFactory<T>
Type Parameters:
T -

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

Serializable proxy factory that allows to create serializable proxies to objects that are themselves not serializable.

This class does not do any cleanup so it is recommended to only use this in test utilities.

Author:
Erik Brakkee

Constructor Summary
SerializableProxyFactory(java.lang.Class<T> aClass, T aSvc)
          Constructs the factory with a callback to create thread-specific objects automatically.
 
Method Summary
 T get()
          Gets the underlying service.
 T getProxy()
          Gets the serializable proxy that delegates to the object passed in the constructor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerializableProxyFactory

public SerializableProxyFactory(java.lang.Class<T> aClass,
                                T aSvc)
Constructs the factory with a callback to create thread-specific objects automatically.

Parameters:
aClass - Interface class of the service to proxy.
aCallback - Callback to create the object if it does not exist. When null, then no initialization is done.
Method Detail

get

public T get()
Gets the underlying service.

Returns:
Service.

getProxy

public T getProxy()
Gets the serializable proxy that delegates to the object passed in the constructor.

Returns:
Proxy.


Copyright © 2021. All Rights Reserved.