1

Possible Duplicate:
Dynamic proxy for concrete classes

Once I create a InvocationHandler implementation, I can use it with Proxy.newProxyInstance function to get a object behaving differently. In this case, I have to create a interface and its implementation class to use the Proxy.newProxyInstance function:

MyInterface objDest = Proxy.newProxyInstance(MyInterfaceImpl.class.getClassLoader(),   
        MyInterfaceImpl.class.getInterfaces(),   
        new MyInvocationHandler(new MyInterfaceImpl()));  

Is it possible to do the same task directly using a simple class without interface?

Community
  • 1
  • 1

1 Answers1

1

You should use CGLIB to create a dynamic proxy on a concrete class.

Hakan Serce
  • 11,198
  • 3
  • 29
  • 48