dynaop manual

Class Proxies

With class proxies, ProxyFactory extends your target class and attaches the mixins and interceptors. The proxy calls methods in the parent class rather than delegating to a separate instance as is the case with dynamic proxies. Class proxies don't require that the target class have an interface, but they do couple the proxy and target instances and introduce some object serialization concerns (you may need to use ProxyContext.getHandle()). The parent class must have a no-argument constructor.

Example 4.2. class proxy instantiation

MyClass myInstance = 
  (MyClass) ProxyFactory.getInstance().extend(MyClassImpl.class);

((MyMixin) myInstance).invokeMixin();