Interface IProxyTargetLocator

  • All Superinterfaces:
    IClusterable, Serializable
    All Known Implementing Classes:
    SpringBeanLocator

    public interface IProxyTargetLocator
    extends IClusterable
    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();
            }
     }
     
    Author:
    Igor Vaynberg (ivaynberg)
    See Also:
    LazyInitProxyFactory.createProxy(Class, IProxyTargetLocator)
    • Method Detail

      • locateProxyTarget

        <T> T locateProxyTarget()
        Returns the object that will be used as target object for a lazy init proxy.
        Returns:
        retrieved object