StandardProxyFactory

The StandardProxyFactory is based on Reflection's Proxy class. With this implementation you can create proxies for interfaces.

A single proxy may implement multiple interfaces as long all of them have disjunct methods i.e. no two interfaces may have a method with same name and argument, but different return types.

StandardProxyFactory is the default ProxyFactory for all ProxyToy implementations. When build() is invoked for any toy, and no ProxyFactory was specified, then StandardProxyFactory is used.

CglibProxyFactory

The CglibProxyFactoryis based on the CGLIB library. This factory has the same features as the StandardProxyFactory. Additionally it can proxy a real class if it is not final. If the proxy instance implements multiple types, only one of them can be a real class.

Note: A proxy for a real class will internally built by CGLIB as a subclass. Therefore you cannot create a proxy for such a type if the class is final. This is also the reason for the limitation of one real class in a set of types, that should be implemented by the proxy. An additional limitation exists for proxies based on a real class, since the invoker instance is not called for final methods. Also the instantiation of such a proxy requires the initialization with the call to a constructor of the proxied base class. The CglibProxyFactory tries to stub the constructor arguments with Null objects if no zero-arg constructor exists. This approach may fail in some cases.