Represents a service locator for lazy init proxies. When the first method
invocation occurs on the lazy init proxy this locator will be used to
retrieve the proxy target object that will receive the method invocation.
Generally implementations should be small when serialized because the main
purpose of lazy init proxies is to be stored in session when the wicket pages
are serialized, and when deserialized to be able to lookup the dependency
again. The smaller the implementation of IProxyTargetLocator the less the
drain on session size.
A small implementation may use a static lookup to retrieve the target object.
Example:
class UserServiceLocator implements IProxyTargetLocator
{
Object locateProxyObject()
{
MyApplication app = (MyApplication) Application.get();
return app.getUserService();
}
}
See Also: LazyInitProxyFactory.createProxy(ClassIProxyTargetLocator) author: Igor Vaynberg (ivaynberg) |